diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-11-15 06:04:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-11-15 06:04:21 +0800 |
commit | 9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91 (patch) | |
tree | 2e1e96f33404781354c422a7e9beaf458ebeb655 /mail | |
parent | 7e8f8bb9e5167b0219b48ab3e8062080d3740b0a (diff) | |
download | gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.gz gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.tar.zst gsoc2013-evolution-9e4fcb29cf7f05c18f7fd34e318f9e795fa32e91.zip |
** Remove trailing whitespace from source code.
2007-11-14 Matthew Barnes <mbarnes@redhat.com>
** Remove trailing whitespace from source code.
svn path=/trunk/; revision=34537
Diffstat (limited to 'mail')
97 files changed, 4220 insertions, 4220 deletions
diff --git a/mail/e-searching-tokenizer.c b/mail/e-searching-tokenizer.c index 9b508280e2..d10e5846dc 100644 --- a/mail/e-searching-tokenizer.c +++ b/mail/e-searching-tokenizer.c @@ -14,12 +14,12 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. - * + * * 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 General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 @@ -41,7 +41,7 @@ #include "libedataserver/e-memory.h" #include "libedataserver/e-msgport.h" -#define d(x) +#define d(x) enum { MATCH_SIGNAL, @@ -144,7 +144,7 @@ loop: r<<=1; m<<=5; } while (r & 0x40); - + *ptr = p; v &= ~m; @@ -224,7 +224,7 @@ struct _trie { EMemChunk *match_chunks; }; -static void +static void dump_trie(struct _state *s, int d) { char *p = alloca(d*2+1); @@ -232,7 +232,7 @@ dump_trie(struct _state *s, int d) memset(p, ' ', d*2); p[d*2]=0; - + printf("%s[state] %p: %d fail->%p\n", p, s, s->final, s->fail); m = s->matches; while (m) { @@ -359,7 +359,7 @@ build_trie(int nocase, int len, unsigned char **words) q = q->next; } } - + d(printf("After failure analysis\n")); d(dump_trie(&trie->root, 0)); @@ -971,18 +971,18 @@ e_searching_tokenizer_finalise (GObject *obj) { ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (obj); struct _ESearchingTokenizerPrivate *p = st->priv; - + search_info_free (p->primary); search_info_free (p->secondary); if (p->engine) searcher_free(p->engine); - - /* again wtf? + + /* again wtf? shared_state_unref (st->priv->shared); */ - + g_free (p); - + if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize(obj); } @@ -992,9 +992,9 @@ e_searching_tokenizer_class_init (ESearchingTokenizerClass *klass) { GObjectClass *obj_class = (GObjectClass *) klass; HTMLTokenizerClass *tok_class = HTML_TOKENIZER_CLASS (klass); - + parent_class = g_type_class_ref (HTML_TYPE_TOKENIZER); - + signals[MATCH_SIGNAL] = g_signal_new ("match", E_TYPE_SEARCHING_TOKENIZER, @@ -1004,12 +1004,12 @@ e_searching_tokenizer_class_init (ESearchingTokenizerClass *klass) NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - + obj_class->finalize = e_searching_tokenizer_finalise; - + tok_class->begin = e_searching_tokenizer_begin; tok_class->end = e_searching_tokenizer_end; - + tok_class->peek_token = e_searching_tokenizer_peek_token; tok_class->next_token = e_searching_tokenizer_next_token; tok_class->has_more = e_searching_tokenizer_has_more; @@ -1026,7 +1026,7 @@ e_searching_tokenizer_init (ESearchingTokenizer *st) p->primary = search_info_new(); search_info_set_flags(p->primary, SEARCH_BOLD, SEARCH_CASE|SEARCH_BOLD); search_info_set_colour(p->primary, "red"); - + p->secondary = search_info_new(); search_info_set_flags(p->secondary, SEARCH_BOLD, SEARCH_CASE|SEARCH_BOLD); search_info_set_colour(p->secondary, "purple"); @@ -1036,7 +1036,7 @@ GType e_searching_tokenizer_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (ESearchingTokenizerClass), @@ -1047,10 +1047,10 @@ e_searching_tokenizer_get_type (void) 0, (GInstanceInitFunc) e_searching_tokenizer_init, }; - + type = g_type_register_static (HTML_TYPE_TOKENIZER, "ESearchingTokenizer", &info, 0); } - + return type; } @@ -1067,7 +1067,7 @@ e_searching_tokenizer_new (void) static char *get_token(HTMLTokenizer *t) { HTMLTokenizerClass *klass = HTML_TOKENIZER_CLASS (parent_class); - + return klass->has_more(t) ? klass->next_token(t) : NULL; } @@ -1132,19 +1132,19 @@ e_searching_tokenizer_next_token (HTMLTokenizer *tok) ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok); int oldmatched; char *token; - + /* If no search is active, just use the default method. */ if (st->priv->engine == NULL) return HTML_TOKENIZER_CLASS (parent_class)->next_token (tok); - + oldmatched = st->priv->engine->matchcount; - + token = searcher_next_token(st->priv->engine); /* not sure if this has to be accurate or just say we had some matches */ if (oldmatched != st->priv->engine->matchcount) g_signal_emit (st, signals[MATCH_SIGNAL], 0); - + return token; } @@ -1170,22 +1170,22 @@ e_searching_tokenizer_clone (HTMLTokenizer *tok) { ESearchingTokenizer *orig_st = E_SEARCHING_TOKENIZER (tok); ESearchingTokenizer *new_st = E_SEARCHING_TOKENIZER (e_searching_tokenizer_new ()); - + search_info_free(new_st->priv->primary); search_info_free(new_st->priv->secondary); - + new_st->priv->primary = search_info_clone(orig_st->priv->primary); new_st->priv->secondary = search_info_clone(orig_st->priv->secondary); - + /* what the fucking what???? */ #if 0 shared_state_ref (orig_st->priv->shared); shared_state_unref (new_st->priv->shared); new_st->priv->shared = orig_st->priv->shared; #endif - + g_signal_connect_swapped (new_st, "match", G_CALLBACK(matched), orig_st); - + return HTML_TOKENIZER (new_st); } /* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ @@ -1194,7 +1194,7 @@ void e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_clear(st->priv->primary); search_info_add_string(st->priv->primary, search_str); } @@ -1203,7 +1203,7 @@ void e_searching_tokenizer_add_primary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_add_string(st->priv->primary, search_str); } @@ -1211,7 +1211,7 @@ void e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *st, gboolean iscase) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_set_flags(st->priv->primary, iscase?SEARCH_CASE:0, SEARCH_CASE); } @@ -1219,7 +1219,7 @@ void e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_clear(st->priv->secondary); search_info_add_string(st->priv->secondary, search_str); } @@ -1228,7 +1228,7 @@ void e_searching_tokenizer_add_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_add_string(st->priv->secondary, search_str); } @@ -1236,7 +1236,7 @@ void e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *st, gboolean iscase) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_set_flags(st->priv->secondary, iscase?SEARCH_CASE:0, SEARCH_CASE); } @@ -1245,9 +1245,9 @@ gint e_searching_tokenizer_match_count (ESearchingTokenizer *st) { g_return_val_if_fail (E_IS_SEARCHING_TOKENIZER (st), -1); - + if (st->priv->engine && st->priv->primary->strv->len) return st->priv->engine->matchcount; - + return 0; } diff --git a/mail/e-searching-tokenizer.h b/mail/e-searching-tokenizer.h index 96aa39640c..9b690d1f46 100644 --- a/mail/e-searching-tokenizer.h +++ b/mail/e-searching-tokenizer.h @@ -12,12 +12,12 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. - * + * * 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 General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 @@ -43,13 +43,13 @@ struct _ESearchingTokenizerPrivate; struct _ESearchingTokenizer { HTMLTokenizer parent; - + struct _ESearchingTokenizerPrivate *priv; }; struct _ESearchingTokenizerClass { HTMLTokenizerClass parent_class; - + void (*match) (ESearchingTokenizer *); }; diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index d748750bde..a15d6f877a 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -153,17 +153,17 @@ typedef struct _EMAccountEditorPrivate { guint sig_removed_id; guint sig_changed_id; const char *sig_uid; - + /* incoming mail */ EMAccountEditorService source; - + /* extra incoming config */ CamelProvider *extra_provider; GSList *extra_items; /* this is freed by the econfig automatically */ /* outgoing mail */ EMAccountEditorService transport; - + /* account management */ GtkEntry *identity_entries[5]; struct _GtkToggleButton *default_account; @@ -275,14 +275,14 @@ em_account_editor_get_type(void) /** * em_account_editor_new: - * @account: - * @type: - * + * @account: + * @type: + * * Create a new account editor. If @account is NULL then this is to * create a new account, else @account is copied to a working * structure and is for editing an existing account. - * - * Return value: + * + * Return value: **/ EMAccountEditor *em_account_editor_new(EAccount *account, em_account_editor_t type, char *id) { @@ -320,12 +320,12 @@ is_email (const char *address) /* This is supposed to check if the address's domain could be an FQDN but alas, it's not worth the pain and suffering. */ const char *at; - + at = strchr (address, '@'); /* make sure we have an '@' and that it's not the first or last char */ if (!at || at == address || *(at + 1) == '\0') return FALSE; - + return TRUE; } @@ -391,7 +391,7 @@ emae_display_license(EMAccountEditor *emae, CamelProvider *prov) char *tmp; GtkResponseType response = GTK_RESPONSE_NONE; char *gladefile; - + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "mail-dialogs.glade", NULL); @@ -407,8 +407,8 @@ emae_display_license(EMAccountEditor *emae, CamelProvider *prov) g_signal_connect(glade_xml_get_widget(xml, "license_checkbutton"), "toggled", G_CALLBACK(emae_license_state), dialog); - tmp = g_strdup_printf(_("\nPlease read carefully the license agreement\n" - "for %s displayed below\n" + tmp = g_strdup_printf(_("\nPlease read carefully the license agreement\n" + "for %s displayed below\n" "and tick the check box for accepting it\n"), prov->license); gtk_label_set_text((GtkLabel *)glade_xml_get_widget(xml, "license_top_label"), tmp); g_free(tmp); @@ -424,7 +424,7 @@ emae_display_license(EMAccountEditor *emae, CamelProvider *prov) gtk_widget_destroy(dialog); g_object_unref(xml); - + return (response == GTK_RESPONSE_ACCEPT); } @@ -438,14 +438,14 @@ emae_check_license(EMAccountEditor *emae, CamelProvider *prov) GSList *providers_list, *l; providers_list = gconf_client_get_list (gconf, "/apps/evolution/mail/licenses", GCONF_VALUE_STRING, NULL); - + for (l = providers_list, accepted = FALSE; l && !accepted; l = g_slist_next(l)) accepted = (strcmp((char *)l->data, prov->protocol) == 0); if (!accepted && (accepted = emae_display_license(emae, prov)) == TRUE) { providers_list = g_slist_append(providers_list, g_strdup(prov->protocol)); - gconf_client_set_list(gconf, + gconf_client_set_list(gconf, "/apps/evolution/mail/licenses", GCONF_VALUE_STRING, providers_list, NULL); @@ -463,7 +463,7 @@ default_folders_clicked (GtkButton *button, gpointer user_data) { EMAccountEditor *emae = user_data; const char *uri; - + uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS); em_folder_selection_button_set_selection((EMFolderSelectionButton *)emae->priv->drafts_folder_button, uri); emae_account_folder_changed((EMFolderSelectionButton *)emae->priv->drafts_folder_button, emae); @@ -771,7 +771,7 @@ emae_setup_receipt_policy (EMAccountEditor *emae, GladeXML *xml) EAccountReceiptPolicy current = emae->account->receipt_policy; static struct { EAccountReceiptPolicy policy; - char *label; + char *label; } receipt_policies[] = { { E_ACCOUNT_RECEIPT_NEVER, N_("Never") }, { E_ACCOUNT_RECEIPT_ALWAYS, N_("Always") }, @@ -789,9 +789,9 @@ emae_setup_receipt_policy (EMAccountEditor *emae, GladeXML *xml) 1, receipt_policies[i].policy, -1); if (current == receipt_policies[i].policy) - active = i; + active = i; } - + gtk_combo_box_set_model(dropdown, (GtkTreeModel *)store); gtk_combo_box_set_active(dropdown, active); @@ -1021,7 +1021,7 @@ emae_url_set_hostport(CamelURL *url, const char *txt) { const char *port; char *host; - + /* FIXME: what if this was a raw IPv6 address? */ if (txt && (port = strchr(txt, ':'))) { camel_url_set_port(url, atoi(port+1)); @@ -1174,16 +1174,16 @@ emae_service_url_path_changed(EMAccountEditorService *service, void (*setval)(Ca GtkTreeModel *model; GtkTreeIter iter; CamelServiceAuthType *authtype; - + CamelURL *url = emae_account_url(service->emae, emae_service_info[service->type].account_uri_key); const char *text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); setval(url, (text && text[0])?text:NULL); - + if (text && text[0] && setval == camel_url_set_user) { dropdown = service->authtype; if(dropdown) { - id = gtk_combo_box_get_active (dropdown); + id = gtk_combo_box_get_active (dropdown); if (id != -1) { model = gtk_combo_box_get_model (dropdown); if (gtk_tree_model_iter_nth_child (model, &iter, NULL, id)) { @@ -1194,7 +1194,7 @@ emae_service_url_path_changed(EMAccountEditorService *service, void (*setval)(Ca } } } - + emae_uri_changed(service, url); camel_url_free(url); } @@ -1274,7 +1274,7 @@ emae_service_provider_changed(EMAccountEditorService *service) enable = e_account_writable_option(service->emae->account, service->provider->protocol, "use_ssl"); gtk_widget_set_sensitive((GtkWidget *)service->use_ssl, enable); - + enable = e_account_writable(service->emae->account, emae_service_info[service->type].save_passwd_key); gtk_widget_set_sensitive((GtkWidget *)service->remember, enable); @@ -1293,7 +1293,7 @@ emae_service_provider_changed(EMAccountEditorService *service) if (j == 0) { if (dwidget == NULL && enable) dwidget = w; - + if (info->setval && !hide) info->setval(url, enable?gtk_entry_get_text((GtkEntry *)w):NULL); } @@ -1319,7 +1319,7 @@ emae_service_provider_changed(EMAccountEditorService *service) camel_url_set_authmech(url, NULL); } } - + emae_refresh_authtype(service->emae, service); if (service->needs_auth && !CAMEL_PROVIDER_NEEDS(service->provider, CAMEL_URL_PART_AUTH)) gtk_widget_show((GtkWidget *)service->needs_auth); @@ -1410,7 +1410,7 @@ emae_refresh_providers(EMAccountEditor *emae, EMAccountEditorService *service) current[len] = 0; } } - + store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); i = 0; @@ -1549,7 +1549,7 @@ emae_refresh_authtype (EMAccountEditor *emae, EMAccountEditorService *service) } else { avail = TRUE; } - + gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, authtype->name, 1, authtype, 2, !avail, -1); @@ -1800,7 +1800,7 @@ emae_identity_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st #endif gtk_widget_hide(glade_xml_get_widget(xml, "sigAddNew")); } - + w = glade_xml_get_widget(xml, item->label); if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) { GladeXML *druidxml; @@ -2269,7 +2269,7 @@ emae_defaults_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st /* Special Folders "Reset Defaults" button */ gui->restore_folders_button = (GtkButton *)glade_xml_get_widget (xml, "default_folders_button"); g_signal_connect (gui->restore_folders_button, "clicked", G_CALLBACK (default_folders_clicked), emae); - + /* Always Cc/Bcc */ emae_account_toggle(emae, "always_cc", E_ACCOUNT_CC_ALWAYS, xml); emae_account_entry(emae, "cc_addrs", E_ACCOUNT_CC_ADDRS, xml); @@ -2280,8 +2280,8 @@ emae_defaults_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st gtk_widget_set_sensitive( (GtkWidget *)gui->sent_folder_button, e_account_writable(emae->account, E_ACCOUNT_SENT_FOLDER_URI) - && - (emae->priv->source.provider ? !(emae->priv->source.provider->flags & CAMEL_PROVIDER_DISABLE_SENT_FOLDER): TRUE) + && + (emae->priv->source.provider ? !(emae->priv->source.provider->flags & CAMEL_PROVIDER_DISABLE_SENT_FOLDER): TRUE) ); gtk_widget_set_sensitive((GtkWidget *)gui->restore_folders_button, @@ -2291,7 +2291,7 @@ emae_defaults_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st /* Receipt policy */ emae_setup_receipt_policy (emae, xml); - + w = glade_xml_get_widget(xml, item->label); gtk_notebook_append_page((GtkNotebook *)parent, w, gtk_label_new(_("Defaults"))); @@ -2328,7 +2328,7 @@ emae_security_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st emae_account_toggle(emae, "pgp_always_sign", E_ACCOUNT_PGP_ALWAYS_SIGN, xml); emae_account_toggle(emae, "pgp_no_imip_sign", E_ACCOUNT_PGP_NO_IMIP_SIGN, xml); emae_account_toggle(emae, "pgp_always_trust", E_ACCOUNT_PGP_ALWAYS_TRUST, xml); - + #if defined (HAVE_NSS) /* TODO: this should handle its entry separately? */ gui->smime_sign_key = emae_account_entry(emae, "smime_sign_key", E_ACCOUNT_SMIME_SIGN_KEY, xml); @@ -2352,7 +2352,7 @@ emae_security_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st { /* Since we don't have NSS, hide the S/MIME config options */ GtkWidget *frame; - + frame = glade_xml_get_widget(xml, "smime_vbox"); gtk_widget_destroy(frame); } @@ -2435,7 +2435,7 @@ emae_management_page(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, NULL); druidxml = glade_xml_new(gladefile, "management_page", NULL); g_free (gladefile); - + page = glade_xml_get_widget(druidxml, "management_page"); gtk_widget_reparent(w, ((GnomeDruidPageStandard *)page)->vbox); @@ -2629,10 +2629,10 @@ emae_check_complete(EConfig *ec, const char *pageid, void *data) } } - /* - Setting a flag on the Account if it is marked as default. It is done in this way instead of - using a temporary variable so as to keep track of which account is marked as default in case of - editing multiple accounts at a time + /* + Setting a flag on the Account if it is marked as default. It is done in this way instead of + using a temporary variable so as to keep track of which account is marked as default in case of + editing multiple accounts at a time */ if (gtk_toggle_button_get_active(emae->priv->default_account)) g_object_set_data (G_OBJECT (emae->account), "default_flagged", GINT_TO_POINTER(1)); @@ -2680,10 +2680,10 @@ add_new_store (char *uri, CamelStore *store, void *user_data) { MailComponent *component = mail_component_peek (); EAccount *account = user_data; - + if (store == NULL) return; - + mail_component_add_store (component, store, account->name); } diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c index bb453d4ea8..dc9f71aaf4 100644 --- a/mail/em-account-prefs.c +++ b/mail/em-account-prefs.c @@ -66,7 +66,7 @@ GType em_account_prefs_get_type (void) { static GType type = 0; - + if (!type) { GTypeInfo type_info = { sizeof (EMAccountPrefsClass), @@ -77,10 +77,10 @@ em_account_prefs_get_type (void) 0, (GInstanceInitFunc) em_account_prefs_init, }; - + type = g_type_register_static (gtk_vbox_get_type (), "EMAccountPrefs", &type_info, 0); } - + return type; } @@ -89,11 +89,11 @@ em_account_prefs_class_init (EMAccountPrefsClass *klass) { GtkObjectClass *gtk_object_class = (GtkObjectClass *) klass; GObjectClass *object_class = (GObjectClass *) klass; - + parent_class = g_type_class_ref (gtk_vbox_get_type ()); - + gtk_object_class->destroy = em_account_prefs_destroy; - + object_class->finalize = em_account_prefs_finalise; } @@ -108,9 +108,9 @@ static void em_account_prefs_destroy (GtkObject *obj) { EMAccountPrefs *prefs = (EMAccountPrefs *) obj; - + prefs->destroyed = TRUE; - + GTK_OBJECT_CLASS (parent_class)->destroy (obj); } @@ -118,9 +118,9 @@ static void em_account_prefs_finalise (GObject *obj) { EMAccountPrefs *prefs = (EMAccountPrefs *) obj; - + g_object_unref (prefs->gui); - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -129,10 +129,10 @@ account_add_finished (EMAccountPrefs *prefs, GObject *deadbeef) { /* Either Cancel or Finished was clicked in the druid so reload the accounts */ prefs->druid = NULL; - + if (!prefs->destroyed) mail_accounts_load (prefs); - + g_object_unref (prefs); } @@ -142,7 +142,7 @@ static void account_add_clicked (GtkButton *button, gpointer user_data) { EMAccountPrefs *prefs = (EMAccountPrefs *) user_data; - + if (prefs->druid == NULL) { EMAccountEditor *emae; @@ -171,10 +171,10 @@ static void account_edit_finished (EMAccountPrefs *prefs, GObject *deadbeef) { prefs->editor = NULL; - + if (!prefs->destroyed) mail_accounts_load (prefs); - + g_object_unref (prefs); } @@ -182,17 +182,17 @@ static void account_edit_clicked (GtkButton *button, gpointer user_data) { EMAccountPrefs *prefs = (EMAccountPrefs *) user_data; - + if (prefs->editor == NULL) { GtkTreeSelection *selection; EAccount *account = NULL; GtkTreeModel *model; GtkTreeIter iter; - + selection = gtk_tree_view_get_selection (prefs->table); if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, 3, &account, -1); - + if (account && !account->parent_uid && !mail_config_has_proxies (account)) { EMAccountEditor *emae; @@ -229,37 +229,37 @@ account_delete_clicked (GtkButton *button, gpointer user_data) GtkTreeIter iter; int ans; gboolean has_proxies = FALSE; - + selection = gtk_tree_view_get_selection (prefs->table); if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, 3, &account, -1); - + /* make sure we have a valid account selected and that we aren't editing anything... */ if (account == NULL || prefs->editor != NULL) return; has_proxies = mail_config_has_proxies (account); ans = e_error_run(PREFS_WINDOW(prefs), has_proxies?"mail:ask-delete-account-with-proxies":"mail:ask-delete-account",NULL); - + if (ans == GTK_RESPONSE_YES) { int len; - + /* remove it from the folder-tree in the shell */ if (account->enabled && account->source && account->source->url) mail_component_remove_store_by_uri (mail_component_peek (), account->source->url); - + /* remove all the proxies account has created*/ if (has_proxies) mail_config_remove_account_proxies (account); - + /* remove it from the config file */ mail_config_remove_account (account); accounts = mail_config_get_accounts (); - + mail_config_write (); - + gtk_list_store_remove ((GtkListStore *) model, &iter); - + len = e_list_length ((EList *) accounts); if (len > 0) { if ( !gtk_list_store_iter_is_valid ((GtkListStore *) model, &iter)) @@ -283,16 +283,16 @@ account_default_clicked (GtkButton *button, gpointer user_data) EAccount *account = NULL; GtkTreeModel *model; GtkTreeIter iter; - + selection = gtk_tree_view_get_selection (prefs->table); if (gtk_tree_selection_get_selected (selection, &model, &iter)) gtk_tree_model_get (model, &iter, 3, &account, -1); - + if (account) { mail_config_set_default_account (account); - + mail_config_write (); - + mail_accounts_load (prefs); } } @@ -309,7 +309,7 @@ account_able_changed(EAccount *account) mail_component_load_store_by_uri (component, account->source->url, account->name); - else + else mail_component_remove_store_by_uri (component, account->source->url); } @@ -324,13 +324,13 @@ account_able_clicked (GtkButton *button, gpointer user_data) EAccount *account; GtkTreeModel *model; GtkTreeIter iter; - + selection = gtk_tree_view_get_selection (prefs->table); if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gtk_tree_model_get (model, &iter, 3, &account, -1); account->enabled = !account->enabled; gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->enabled, -1); - + gtk_button_set_label (prefs->mail_able, account->enabled ? _("Di_sable") : _("E_nable")); /* let the rest of the application know it changed */ @@ -348,26 +348,26 @@ account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; - + path = gtk_tree_path_new_from_string (arg1); model = gtk_tree_view_get_model (prefs->table); selection = gtk_tree_view_get_selection (prefs->table); - + if (gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_model_get (model, &iter, 3, &account, -1); if (mail_config_has_proxies (account)) { - int ans; + int ans; ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-proxy-accounts",NULL); - if (ans == GTK_RESPONSE_NO) { + if (ans == GTK_RESPONSE_NO) { gtk_tree_path_free (path); return; - } + } mail_config_remove_account_proxies (account); - gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), 1); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), 1); } account->enabled = !account->enabled; @@ -419,8 +419,8 @@ account_cursor_change (GtkTreeSelection *selection, EMAccountPrefs *prefs) } else { gtk_widget_set_sensitive (GTK_WIDGET (prefs), FALSE); } - - if( url != NULL ) + + if( url != NULL ) gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), !mail_config_has_proxies(account)); gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), state); @@ -444,25 +444,25 @@ mail_accounts_load (EMAccountPrefs *prefs) EIterator *node; int row = 0; GtkTreeSelection *selection; - + model = (GtkListStore *) gtk_tree_view_get_model (prefs->table); gtk_list_store_clear (model); - + default_account = mail_config_get_default_account (); - + accounts = mail_config_get_accounts (); node = e_list_get_iterator ((EList *) accounts); selection = gtk_tree_view_get_selection(prefs->table); - + while (e_iterator_is_valid (node)) { EAccount *account; CamelURL *url; - + account = (EAccount *) e_iterator_get (node); if (!account->parent_uid) { url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL; - + gtk_list_store_append (model, &iter); if (account == default_account) { /* translators: default account indicator */ @@ -479,19 +479,19 @@ mail_accounts_load (EMAccountPrefs *prefs) 3, account, -1); g_free (name); - + if (url) camel_url_free (url); - + /* select the first row by default */ if (row == 0 && !prefs->changed) - gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_selection_select_iter (selection, &iter); row++; } - + e_iterator_next (node); } - + g_object_unref (node); } @@ -507,23 +507,23 @@ em_account_prefs_treeview_new (char *widget_name, char *string1, char *string2, GtkTreeSelection *selection; GtkCellRenderer *renderer; GtkListStore *model; - + scrolled = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN); - + renderer = gtk_cell_renderer_toggle_new (); g_object_set ((GObject *) renderer, "activatable", TRUE, NULL); - + model = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); table = gtk_tree_view_new_with_model ((GtkTreeModel *) model); g_object_unref (model); gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, _("Enabled"), renderer, "active", 0, NULL); - + g_object_set_data ((GObject *) scrolled, "renderer", renderer); - + renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes ((GtkTreeView *) table, -1, _("Account name"), renderer, "text", 1, NULL); @@ -534,18 +534,18 @@ em_account_prefs_treeview_new (char *widget_name, char *string1, char *string2, gtk_tree_view_set_headers_visible ((GtkTreeView *) table, TRUE); atk_object_set_name (gtk_widget_get_accessible (table), _("Mail Accounts")); - + /* FIXME: column auto-resize? */ /* Is this needed? gtk_tree_view_column_set_alignment (gtk_tree_view_get_column (prefs->table, 0), 1.0);*/ - + gtk_container_add (GTK_CONTAINER (scrolled), table); - + g_object_set_data ((GObject *) scrolled, "table", table); - + gtk_widget_show (scrolled); gtk_widget_show (table); - + return scrolled; } @@ -556,7 +556,7 @@ em_account_prefs_construct (EMAccountPrefs *prefs) GtkCellRenderer *renderer; GladeXML *gui; char *gladefile; - + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "mail-config.glade", NULL); @@ -564,20 +564,20 @@ em_account_prefs_construct (EMAccountPrefs *prefs) g_free (gladefile); prefs->gui = gui; - + /* get our toplevel widget */ toplevel = glade_xml_get_widget (gui, "toplevel"); - + /* reparent */ g_object_ref (toplevel); gtk_container_remove (GTK_CONTAINER (toplevel->parent), toplevel); gtk_container_add (GTK_CONTAINER (prefs), toplevel); g_object_unref (toplevel); - + widget = glade_xml_get_widget (gui, "etableMailAccounts"); - + prefs->table = (GtkTreeView *) g_object_get_data ((GObject *) widget, "table"); - + renderer = g_object_get_data ((GObject *) widget, "renderer"); g_signal_connect (renderer, "toggled", G_CALLBACK (account_able_toggled), prefs); @@ -587,16 +587,16 @@ em_account_prefs_construct (EMAccountPrefs *prefs) prefs->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAdd")); g_signal_connect (prefs->mail_add, "clicked", G_CALLBACK (account_add_clicked), prefs); - + prefs->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountEdit")); g_signal_connect (prefs->mail_edit, "clicked", G_CALLBACK (account_edit_clicked), prefs); - + prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDelete")); g_signal_connect (prefs->mail_delete, "clicked", G_CALLBACK (account_delete_clicked), prefs); - + prefs->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDefault")); g_signal_connect (prefs->mail_default, "clicked", G_CALLBACK (account_default_clicked), prefs); - + prefs->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAble")); g_signal_connect (prefs->mail_able, "clicked", G_CALLBACK (account_able_clicked), prefs); @@ -611,10 +611,10 @@ GtkWidget * em_account_prefs_new (GNOME_Evolution_Shell shell) { EMAccountPrefs *new; - + new = (EMAccountPrefs *) g_object_new (em_account_prefs_get_type (), NULL); em_account_prefs_construct (new); new->shell = shell; - + return (GtkWidget *) new; } diff --git a/mail/em-account-prefs.h b/mail/em-account-prefs.h index c7209f67a5..e3fc4c65e4 100644 --- a/mail/em-account-prefs.h +++ b/mail/em-account-prefs.h @@ -53,31 +53,31 @@ typedef struct _EMAccountPrefsClass EMAccountPrefsClass; struct _EMAccountPrefs { GtkVBox parent_object; - + GNOME_Evolution_Shell shell; - + GladeXML *gui; - + GtkWidget *druid; GtkWidget *editor; - + GtkTreeView *table; - + GtkButton *mail_add; GtkButton *mail_edit; GtkButton *mail_delete; GtkButton *mail_default; GtkButton *mail_able; - + guint destroyed : 1; guint changed : 1; }; struct _EMAccountPrefsClass { GtkVBoxClass parent_class; - + /* signals */ - + }; diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index 15944bad72..4839e4e1f6 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -87,7 +87,7 @@ GType em_composer_prefs_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMComposerPrefsClass), @@ -98,10 +98,10 @@ em_composer_prefs_get_type (void) 0, (GInstanceInitFunc) em_composer_prefs_init, }; - + type = g_type_register_static (gtk_vbox_get_type (), "EMComposerPrefs", &info, 0); } - + return type; } @@ -110,9 +110,9 @@ em_composer_prefs_class_init (EMComposerPrefsClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - + parent_class = g_type_class_ref (gtk_vbox_get_type ()); - + object_class->destroy = em_composer_prefs_destroy; gobject_class->finalize = em_composer_prefs_finalise; } @@ -131,12 +131,12 @@ static void em_composer_prefs_finalise (GObject *obj) { EMComposerPrefs *prefs = (EMComposerPrefs *) obj; - + g_object_unref (prefs->gui); g_object_unref (prefs->enabled_pixbuf); - + g_hash_table_destroy (prefs->sig_hash); - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -145,24 +145,24 @@ em_composer_prefs_destroy (GtkObject *obj) { EMComposerPrefs *prefs = (EMComposerPrefs *) obj; ESignatureList *signatures; - + signatures = mail_config_get_signatures (); - + if (prefs->sig_added_id != 0) { g_signal_handler_disconnect (signatures, prefs->sig_added_id); prefs->sig_added_id = 0; } - + if (prefs->sig_removed_id != 0) { g_signal_handler_disconnect (signatures, prefs->sig_removed_id); prefs->sig_removed_id = 0; } - + if (prefs->sig_changed_id != 0) { g_signal_handler_disconnect (signatures, prefs->sig_changed_id); prefs->sig_changed_id = 0; } - + GTK_OBJECT_CLASS (parent_class)->destroy (obj); } @@ -171,26 +171,26 @@ static void sig_load_preview (EMComposerPrefs *prefs, ESignature *sig) { char *str; - + if (!sig) { gtk_html_load_from_string (GTK_HTML (prefs->sig_preview), " ", 1); return; } - + if (sig->script) str = mail_config_signature_run_script (sig->filename); else str = e_msg_composer_get_sig_file_content (sig->filename, sig->html); if (!str) str = g_strdup (""); - + /* printf ("HTML: %s\n", str); */ if (sig->html) { gtk_html_load_from_string (GTK_HTML (prefs->sig_preview), str, strlen (str)); } else { GtkHTMLStream *stream; int len; - + len = strlen (str); stream = gtk_html_begin_content (GTK_HTML (prefs->sig_preview), "text/html; charset=utf-8"); gtk_html_write (GTK_HTML (prefs->sig_preview), stream, "<PRE>", 5); @@ -199,7 +199,7 @@ sig_load_preview (EMComposerPrefs *prefs, ESignature *sig) gtk_html_write (GTK_HTML (prefs->sig_preview), stream, "</PRE>", 6); gtk_html_end (GTK_HTML (prefs->sig_preview), stream, GTK_HTML_STREAM_OK); } - + g_free (str); } @@ -210,19 +210,19 @@ signature_added (ESignatureList *signatures, ESignature *sig, EMComposerPrefs *p GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; - + /* autogen signature is special */ if (sig->autogen) return; - + model = gtk_tree_view_get_model (prefs->sig_list); gtk_list_store_append ((GtkListStore *) model, &iter); gtk_list_store_set ((GtkListStore *) model, &iter, 0, sig->name, 1, sig, -1); - + path = gtk_tree_model_get_path (model, &iter); row = gtk_tree_row_reference_new (model, path); gtk_tree_path_free (path); - + g_hash_table_insert (prefs->sig_hash, sig, row); } @@ -233,19 +233,19 @@ signature_removed (ESignatureList *signatures, ESignature *sig, EMComposerPrefs GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; - + if (!(row = g_hash_table_lookup (prefs->sig_hash, sig))) return; - + model = gtk_tree_view_get_model (prefs->sig_list); path = gtk_tree_row_reference_get_path (row); g_hash_table_remove (prefs->sig_hash, sig); - + if (!gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_path_free (path); return; } - + gtk_list_store_remove ((GtkListStore *) model, &iter); } @@ -258,22 +258,22 @@ signature_changed (ESignatureList *signatures, ESignature *sig, EMComposerPrefs GtkTreePath *path; GtkTreeIter iter; ESignature *cur; - + if (!(row = g_hash_table_lookup (prefs->sig_hash, sig))) return; - + model = gtk_tree_view_get_model (prefs->sig_list); path = gtk_tree_row_reference_get_path (row); - + if (!gtk_tree_model_get_iter (model, &iter, path)) { gtk_tree_path_free (path); return; } - + gtk_tree_path_free (path); - + gtk_list_store_set ((GtkListStore *) model, &iter, 0, sig->name, -1); - + selection = gtk_tree_view_get_selection (prefs->sig_list); if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gtk_tree_model_get (model, &iter, 1, &cur, -1); @@ -290,36 +290,36 @@ sig_edit_cb (GtkWidget *widget, EMComposerPrefs *prefs) GtkWidget *parent; GtkTreeIter iter; ESignature *sig; - + selection = gtk_tree_view_get_selection (prefs->sig_list); if (!gtk_tree_selection_get_selected (selection, &model, &iter)) return; - + gtk_tree_model_get (model, &iter, 1, &sig, -1); - + if (!sig->script) { /* normal signature */ if (!sig->filename || *sig->filename == '\0') { g_free (sig->filename); sig->filename = g_strdup (_("Unnamed")); } - + parent = gtk_widget_get_toplevel ((GtkWidget *) prefs); parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - + mail_signature_editor (sig, (GtkWindow *) parent, FALSE); } else { /* signature script */ GtkWidget *entry; - + entry = glade_xml_get_widget (prefs->sig_script_gui, "filechooserbutton_add_script"); gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (entry), sig->filename); - + entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name"); gtk_entry_set_text (GTK_ENTRY (entry), sig->name); - + g_object_set_data ((GObject *) entry, "sig", sig); - + gtk_window_present ((GtkWindow *) prefs->sig_script_dialog); } } @@ -328,12 +328,12 @@ void em_composer_prefs_new_signature (GtkWindow *parent, gboolean html) { ESignature *sig; - + sig = mail_config_signature_new (NULL, FALSE, html); mail_signature_editor (sig, parent, TRUE); } -static void +static void sig_delete_cb (GtkWidget *widget, EMComposerPrefs *prefs) { GtkTreeSelection *selection; @@ -356,13 +356,13 @@ sig_add_cb (GtkWidget *widget, EMComposerPrefs *prefs) GConfClient *gconf; gboolean send_html; GtkWidget *parent; - + gconf = mail_config_get_gconf_client (); send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL); - + parent = gtk_widget_get_toplevel ((GtkWidget *) prefs); parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - + em_composer_prefs_new_signature ((GtkWindow *) parent, send_html); gtk_widget_grab_focus ((GtkWidget *)prefs->sig_list); } @@ -374,19 +374,19 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs) GtkWidget *entry; const char *name; int argc; - + if (button == GTK_RESPONSE_ACCEPT) { entry = glade_xml_get_widget (prefs->sig_script_gui, "filechooserbutton_add_script"); script = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (entry)); - + entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name"); name = gtk_entry_get_text (GTK_ENTRY (entry)); if (script && *script && g_shell_parse_argv (script, &argc, &argv, NULL)) { struct stat st; - + if (g_stat (argv[0], &st) == 0 && S_ISREG (st.st_mode) && g_access (argv[0], X_OK) == 0) { ESignature *sig; - + if ((sig = g_object_get_data ((GObject *) entry, "sig"))) { /* we're just editing an existing signature script */ g_free (sig->name); @@ -397,27 +397,27 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs) } else { sig = mail_config_signature_new (script, TRUE, TRUE); sig->name = g_strdup (name); - + e_signature_list_add (mail_config_get_signatures (), sig); g_object_unref (sig); } - + mail_config_save_signatures(); gtk_widget_hide (prefs->sig_script_dialog); g_strfreev (argv); g_free (script); - + return; } } - + e_error_run((GtkWindow *)prefs->sig_script_dialog, "mail:signature-notscript", argv ? argv[0] : script, NULL); g_strfreev (argv); g_free (script); return; } - + gtk_widget_hide (widget); } @@ -425,12 +425,12 @@ static void sig_add_script_cb (GtkWidget *widget, EMComposerPrefs *prefs) { GtkWidget *entry; - + entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name"); gtk_entry_set_text (GTK_ENTRY (entry), _("Unnamed")); - + g_object_set_data ((GObject *) entry, "sig", NULL); - + gtk_window_present ((GtkWindow *) prefs->sig_script_dialog); } @@ -441,14 +441,14 @@ sig_selection_changed (GtkTreeSelection *selection, EMComposerPrefs *prefs) GtkTreeIter iter; ESignature *sig; int state; - + state = gtk_tree_selection_get_selected (selection, &model, &iter); if (state) { gtk_tree_model_get (model, &iter, 1, &sig, -1); sig_load_preview (prefs, sig); } else sig_load_preview (prefs, NULL); - + gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, state); gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, state); } @@ -459,27 +459,27 @@ sig_fill_list (EMComposerPrefs *prefs) ESignatureList *signatures; GtkListStore *model; EIterator *it; - + model = (GtkListStore *) gtk_tree_view_get_model (prefs->sig_list); gtk_list_store_clear (model); - + signatures = mail_config_get_signatures (); it = e_list_get_iterator ((EList *) signatures); - + while (e_iterator_is_valid (it)) { ESignature *sig; - + sig = (ESignature *) e_iterator_get (it); signature_added (signatures, sig, prefs); - + e_iterator_next (it); } - + g_object_unref (it); - + gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, FALSE); gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, FALSE); - + prefs->sig_added_id = g_signal_connect (signatures, "signature-added", G_CALLBACK (signature_added), prefs); prefs->sig_removed_id = g_signal_connect (signatures, "signature-removed", G_CALLBACK (signature_removed), prefs); prefs->sig_changed_id = g_signal_connect (signatures, "signature-changed", G_CALLBACK (signature_changed), prefs); @@ -493,7 +493,7 @@ url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle) ssize_t size; int fd; char *filename; - + if (!strncmp (url, "file:", 5)) filename = g_filename_from_uri (url, NULL, NULL); else @@ -512,7 +512,7 @@ url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle) } } else status = GTK_HTML_STREAM_ERROR; - + gtk_html_end (html, handle, status); if (fd > 0) close (fd); @@ -542,37 +542,37 @@ spell_set_ui (EMComposerPrefs *prefs) gboolean go; char *lang; int i; - + prefs->spell_active = FALSE; - + /* setup the language list */ if (!(lang = gconf_client_get_string (prefs->gconf, GNOME_SPELL_GCONF_DIR "/language", &err)) || err) { g_free (lang); g_clear_error (&err); lang = g_strdup (e_iconv_locale_language ()); } - + present = g_hash_table_new (g_str_hash, g_str_equal); if (lang && (strv = g_strsplit (lang, " ", 0))) { for (i = 0; strv[i]; i++) g_hash_table_insert (present, strv[i], strv[i]); } - + g_free (lang); - + model = (GtkListStore *) gtk_tree_view_get_model (prefs->language); for (go = gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter); go; go = gtk_tree_model_iter_next ((GtkTreeModel *) model, &iter)) { char *abbr; - + gtk_tree_model_get ((GtkTreeModel *) model, &iter, 2, &abbr, -1); gtk_list_store_set (model, &iter, 0, g_hash_table_lookup (present, abbr) != NULL, -1); } - + g_hash_table_destroy (present); if (strv != NULL) g_strfreev (strv); - + color.red = gconf_client_get_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_red", NULL); color.green = gconf_client_get_int (prefs->gconf, @@ -580,7 +580,7 @@ spell_set_ui (EMComposerPrefs *prefs) color.blue = gconf_client_get_int (prefs->gconf, GNOME_SPELL_GCONF_DIR "/spell_error_color_blue", NULL); gtk_color_button_set_color (GTK_COLOR_BUTTON (prefs->color), &color); - + prefs->spell_active = TRUE; } @@ -609,36 +609,36 @@ spell_get_language_str (EMComposerPrefs *prefs) GtkTreeIter iter; GString *str; char *rv; - + model = (GtkListStore *) gtk_tree_view_get_model (prefs->language); if (!gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter)) return NULL; - + str = g_string_new (""); - + do { gboolean state; char *abbr; - + gtk_tree_model_get ((GtkTreeModel *) model, &iter, 0, &state, 2, &abbr, -1); - + if (state) { if (str->len) g_string_append_c (str, ' '); g_string_append (str, abbr); } - + if (!gtk_tree_model_iter_next ((GtkTreeModel *) model, &iter)) break; } while (1); - + rv = str->str; g_string_free (str, FALSE); - + return rv; } -static void +static void spell_language_toggled (GtkCellRendererToggle *renderer, const char *path_string, EMComposerPrefs *prefs) { GtkTreePath *path = gtk_tree_path_new_from_string (path_string); @@ -646,12 +646,12 @@ spell_language_toggled (GtkCellRendererToggle *renderer, const char *path_string GtkTreeIter iter; gboolean enabled; char *str; - + model = gtk_tree_view_get_model (prefs->language); gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, 0, &enabled, -1); gtk_list_store_set ((GtkListStore *) model, &iter, 0, !enabled, -1); - + str = spell_get_language_str (prefs); gconf_client_set_string (prefs->gconf, GNOME_SPELL_GCONF_DIR "/language", str ? str : "", NULL); g_free (str); @@ -666,9 +666,9 @@ spell_setup (EMComposerPrefs *prefs) GtkTreeIter iter; GtkWidget *widget; int i; - + model = (GtkListStore *) gtk_tree_view_get_model (prefs->language); - + if (prefs->language_seq) { for (i = 0; i < prefs->language_seq->_length; i++) { gtk_list_store_append (model, &iter); @@ -678,9 +678,9 @@ spell_setup (EMComposerPrefs *prefs) -1); } } - + spell_set_ui (prefs); - + widget = glade_xml_get_widget (prefs->gui, "colorButtonSpellCheckColor"); g_signal_connect (widget, "color_set", G_CALLBACK (spell_color_set), prefs); } @@ -691,28 +691,28 @@ spell_setup_check_options (EMComposerPrefs *prefs) GNOME_Spell_Dictionary dict; CORBA_Environment ev; char *dictionary_id; - + dictionary_id = "OAFIID:GNOME_Spell_Dictionary:" SPELL_API_VERSION; dict = bonobo_activation_activate_from_id (dictionary_id, 0, NULL, NULL); if (dict == CORBA_OBJECT_NIL) { g_warning ("Cannot activate %s", dictionary_id); - + return FALSE; } - + CORBA_exception_init (&ev); prefs->language_seq = GNOME_Spell_Dictionary_getLanguages (dict, &ev); if (ev._major != CORBA_NO_EXCEPTION) prefs->language_seq = NULL; CORBA_exception_free (&ev); - + if (prefs->language_seq == NULL) return FALSE; - + gconf_client_add_dir (prefs->gconf, GNOME_SPELL_GCONF_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL); - + spell_setup (prefs); - + return TRUE; } @@ -725,9 +725,9 @@ static void attach_style_info (GtkWidget *item, gpointer user_data) { int *style = user_data; - + g_object_set_data ((GObject *) item, "style", GINT_TO_POINTER (*style)); - + (*style)++; } @@ -735,7 +735,7 @@ static void toggle_button_toggled (GtkToggleButton *toggle, EMComposerPrefs *prefs) { const char *key; - + key = g_object_get_data ((GObject *) toggle, "key"); gconf_client_set_bool (prefs->gconf, key, gtk_toggle_button_get_active (toggle), NULL); } @@ -745,10 +745,10 @@ style_activate (GtkWidget *item, EMComposerPrefs *prefs) { const char *key; int style; - + key = g_object_get_data ((GObject *) item, "key"); style = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "style")); - + gconf_client_set_int (prefs->gconf, key, style, NULL); } @@ -757,11 +757,11 @@ charset_activate (GtkWidget *item, EMComposerPrefs *prefs) { GtkWidget *menu; char *string; - + menu = gtk_option_menu_get_menu (prefs->charset); if (!(string = e_charset_picker_get_charset (menu))) string = g_strdup (e_iconv_locale_charset ()); - + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/composer/charset", string, NULL); g_free (string); } @@ -771,9 +771,9 @@ option_menu_connect (EMComposerPrefs *prefs, GtkOptionMenu *omenu, GCallback cal { GtkWidget *menu, *item; GList *items; - + menu = gtk_option_menu_get_menu (omenu); - + items = GTK_MENU_SHELL (menu)->children; while (items) { item = items->data; @@ -781,7 +781,7 @@ option_menu_connect (EMComposerPrefs *prefs, GtkOptionMenu *omenu, GCallback cal g_signal_connect (item, "activate", callback, prefs); items = items->next; } - + if (!gconf_client_key_is_writable (prefs->gconf, key, NULL)) gtk_widget_set_sensitive ((GtkWidget *) omenu, FALSE); } @@ -790,13 +790,13 @@ static void toggle_button_init (EMComposerPrefs *prefs, GtkToggleButton *toggle, int not, const char *key) { gboolean bool; - + bool = gconf_client_get_bool (prefs->gconf, key, NULL); gtk_toggle_button_set_active (toggle, not ? !bool : bool); - + g_object_set_data ((GObject *) toggle, "key", (void *) key); g_signal_connect (toggle, "toggled", G_CALLBACK (toggle_button_toggled), prefs); - + if (!gconf_client_key_is_writable (prefs->gconf, key, NULL)) gtk_widget_set_sensitive ((GtkWidget *) toggle, FALSE); } @@ -832,8 +832,8 @@ emcp_free(EConfig *ec, GSList *items, void *data) } static gboolean -signature_key_press (GtkTreeView *tree_view, GdkEventKey *event, EMComposerPrefs *prefs) -{ +signature_key_press (GtkTreeView *tree_view, GdkEventKey *event, EMComposerPrefs *prefs) +{ gboolean ret = FALSE; /* No need to care about anything other than DEL key */ @@ -845,16 +845,16 @@ signature_key_press (GtkTreeView *tree_view, GdkEventKey *event, EMComposerPrefs return ret; } -static gboolean +static gboolean sig_tree_event_cb (GtkTreeView *tree_view, GdkEvent *event, EMComposerPrefs *prefs) { gboolean ret = FALSE; - + if (event->type == GDK_2BUTTON_PRESS) { sig_edit_cb ((GtkWidget *)tree_view, prefs); ret = TRUE; - } - + } + return ret; } @@ -874,9 +874,9 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) GSList *l; int i; char *gladefile; - + prefs->gconf = mail_config_get_gconf_client (); - + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "mail-config.glade", NULL); @@ -900,24 +900,24 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) e_config_add_items((EConfig *)ec, l, NULL, NULL, emcp_free, prefs); /* General tab */ - + /* Default Behavior */ prefs->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML")); toggle_button_init (prefs, prefs->send_html, FALSE, "/apps/evolution/mail/composer/send_html"); - + prefs->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject")); toggle_button_init (prefs, prefs->prompt_empty_subject, FALSE, "/apps/evolution/mail/prompts/empty_subject"); - + prefs->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly")); toggle_button_init (prefs, prefs->prompt_bcc_only, FALSE, "/apps/evolution/mail/prompts/only_bcc"); - + prefs->auto_smileys = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkAutoSmileys")); toggle_button_init (prefs, prefs->auto_smileys, FALSE, "/apps/evolution/mail/composer/magic_smileys"); - + prefs->top_signature = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkTopSignature")); toggle_button_init (prefs, prefs->top_signature, FALSE, "/apps/evolution/mail/composer/top_signature"); @@ -925,7 +925,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) prefs->spell_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEnableSpellChecking")); toggle_button_init (prefs, prefs->spell_check, FALSE, "/apps/evolution/mail/composer/inline_spelling"); - + prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/composer/charset", NULL); menu = e_charset_picker_new (buf && *buf ? buf : e_iconv_locale_charset ()); @@ -933,7 +933,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) option_menu_connect (prefs, prefs->charset, G_CALLBACK (charset_activate), "/apps/evolution/mail/composer/charset"); g_free (buf); - + /* Spell Checking: GNOME Spell part */ prefs->color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, "colorButtonSpellCheckColor")); prefs->language = GTK_TREE_VIEW (glade_xml_get_widget (gui, "listSpellCheckLanguage")); @@ -945,7 +945,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) "active", 0, NULL); g_signal_connect (cell_renderer, "toggled", G_CALLBACK (spell_language_toggled), prefs); - + gtk_tree_view_insert_column_with_attributes (prefs->language, -1, _("Language(s)"), gtk_cell_renderer_text_new (), "text", 1, @@ -958,7 +958,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) gtk_widget_hide (GTK_WIDGET (prefs->color)); gtk_widget_hide (GTK_WIDGET (prefs->language)); } - + /* Forwards and Replies */ prefs->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle")); style = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/format/forward_style", NULL); @@ -968,7 +968,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) attach_style_info, &style); option_menu_connect (prefs, prefs->forward_style, G_CALLBACK (style_activate), "/apps/evolution/mail/format/forward_style"); - + prefs->reply_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuReplyStyle")); style = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/format/reply_style", NULL); gtk_option_menu_set_history (prefs->reply_style, style); @@ -977,14 +977,14 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) attach_style_info, &style); option_menu_connect (prefs, prefs->reply_style, G_CALLBACK (style_activate), "/apps/evolution/mail/format/reply_style"); - + /* Signatures */ dialog = (GtkDialog *) gtk_dialog_new (); - + gtk_widget_realize ((GtkWidget *) dialog); gtk_container_set_border_width ((GtkContainer *)dialog->action_area, 12); gtk_container_set_border_width ((GtkContainer *)dialog->vbox, 0); - + prefs->sig_script_dialog = (GtkWidget *) dialog; gtk_dialog_add_buttons (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); @@ -993,19 +993,19 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) g_signal_connect (dialog, "response", G_CALLBACK (sig_add_script_response), prefs); widget = glade_xml_get_widget (prefs->sig_script_gui, "vbox_add_script_signature"); gtk_box_pack_start ((GtkBox *) dialog->vbox, widget, TRUE, TRUE, 0); - + prefs->sig_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureAdd")); g_signal_connect (prefs->sig_add, "clicked", G_CALLBACK (sig_add_cb), prefs); - + prefs->sig_add_script = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureAddScript")); g_signal_connect (prefs->sig_add_script, "clicked", G_CALLBACK (sig_add_script_cb), prefs); - + prefs->sig_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureEdit")); g_signal_connect (prefs->sig_edit, "clicked", G_CALLBACK (sig_edit_cb), prefs); - + prefs->sig_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureDelete")); g_signal_connect (prefs->sig_delete, "clicked", G_CALLBACK (sig_delete_cb), prefs); - + prefs->sig_list = GTK_TREE_VIEW (glade_xml_get_widget (gui, "listSignatures")); model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); gtk_tree_view_set_model (prefs->sig_list, (GtkTreeModel *)model); @@ -1017,9 +1017,9 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); g_signal_connect (selection, "changed", G_CALLBACK (sig_selection_changed), prefs); g_signal_connect (prefs->sig_list, "event", G_CALLBACK (sig_tree_event_cb), prefs); - + sig_fill_list (prefs); - + /* preview GtkHTML widget */ widget = glade_xml_get_widget (gui, "scrolled-sig"); prefs->sig_preview = (GtkHTML *) gtk_html_new (); @@ -1032,7 +1032,7 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) e_config_set_target((EConfig *)ec, (EConfigTarget *)target); toplevel = e_config_create_widget((EConfig *)ec); gtk_container_add (GTK_CONTAINER (prefs), toplevel); - + g_signal_connect (prefs->sig_list, "key-press-event", G_CALLBACK(signature_key_press), prefs); } @@ -1040,9 +1040,9 @@ GtkWidget * em_composer_prefs_new (void) { EMComposerPrefs *new; - + new = (EMComposerPrefs *) g_object_new (em_composer_prefs_get_type (), NULL); em_composer_prefs_construct (new); - + return (GtkWidget *) new; } diff --git a/mail/em-composer-prefs.h b/mail/em-composer-prefs.h index e6e3638dd9..9a34dcda0a 100644 --- a/mail/em-composer-prefs.h +++ b/mail/em-composer-prefs.h @@ -55,36 +55,36 @@ struct _GtkWindow; struct _EMComposerPrefs { GtkVBox parent_object; - + struct _GConfClient *gconf; - + struct _GladeXML *gui; - + /* General tab */ - + /* Default Behavior */ struct _GtkToggleButton *send_html; struct _GtkToggleButton *auto_smileys; struct _GtkToggleButton *prompt_empty_subject; struct _GtkToggleButton *prompt_bcc_only; struct _GtkOptionMenu *charset; - + struct _GtkToggleButton *spell_check; struct _GtkColorButton *color; struct _GtkTreeView *language; CORBA_sequence_GNOME_Spell_Language *language_seq; gboolean spell_active; - + struct _GdkPixbuf *enabled_pixbuf; - + /* Forwards and Replies */ struct _GtkOptionMenu *forward_style; struct _GtkOptionMenu *reply_style; struct _GtkToggleButton *top_signature; - + /* Keyboard Shortcuts */ struct _GtkOptionMenu *shortcuts_type; - + /* Signatures */ struct _GtkTreeView *sig_list; GHashTable *sig_hash; @@ -93,10 +93,10 @@ struct _EMComposerPrefs { struct _GtkButton *sig_edit; struct _GtkButton *sig_delete; struct _GtkHTML *sig_preview; - + struct _GladeXML *sig_script_gui; struct _GtkWidget *sig_script_dialog; - + guint sig_added_id; guint sig_removed_id; guint sig_changed_id; @@ -104,9 +104,9 @@ struct _EMComposerPrefs { struct _EMComposerPrefsClass { GtkVBoxClass parent_class; - + /* signals */ - + }; GType em_composer_prefs_get_type (void); diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index ab3e6c7812..580c9650f9 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -70,10 +70,10 @@ static EAccount * guess_account (CamelMimeMessage *message, CamelFolder *folder) struct emcs_t { unsigned int ref_count; - + CamelFolder *drafts_folder; char *drafts_uid; - + CamelFolder *folder; guint32 flags, set; char *uid; @@ -83,7 +83,7 @@ static struct emcs_t * emcs_new (void) { struct emcs_t *emcs; - + emcs = g_new (struct emcs_t, 1); emcs->ref_count = 1; emcs->drafts_folder = NULL; @@ -92,7 +92,7 @@ emcs_new (void) emcs->flags = 0; emcs->set = 0; emcs->uid = NULL; - + return emcs; } @@ -102,7 +102,7 @@ free_emcs (struct emcs_t *emcs) if (emcs->drafts_folder) camel_object_unref (emcs->drafts_folder); g_free (emcs->drafts_uid); - + if (emcs->folder) camel_object_unref (emcs->folder); g_free (emcs->uid); @@ -135,14 +135,14 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip gboolean res; GString *str; int i; - + str = g_string_new(""); for (i = 0; recipients[i] != NULL; ++i) { if (!e_destination_get_html_mail_pref (recipients[i])) { const char *name; - + name = e_destination_get_textrep (recipients[i], FALSE); - + g_string_append_printf (str, " %s\n", name); } } @@ -173,7 +173,7 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case) realizing it. To try to avoid being totally confusing, I've changed this dialog to provide slightly different text in that case, to better explain what the hell is going on. */ - + return em_utils_prompt_user((GtkWindow *)composer, "/apps/evolution/mail/prompts/only_bcc", hidden_list_case?"mail:ask-send-only-bcc-contact":"mail:ask-send-only-bcc", NULL); } @@ -190,9 +190,9 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag { struct emcs_t *emcs; struct _send_data *send = data; - + emcs = send->emcs; - + if (queued) { if (emcs && emcs->drafts_folder) { /* delete the old draft message */ @@ -204,7 +204,7 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag g_free (emcs->drafts_uid); emcs->drafts_uid = NULL; } - + if (emcs && emcs->folder) { /* set any replied flags etc */ camel_folder_set_message_flags (emcs->folder, emcs->uid, emcs->flags, emcs->set); @@ -214,9 +214,9 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag g_free (emcs->uid); emcs->uid = NULL; } - + gtk_widget_destroy (GTK_WIDGET (send->composer)); - + if (send->send && camel_session_is_online (session)) { /* queue a message send */ mail_send (); @@ -228,20 +228,20 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag 0, NULL, em_utils_composer_send_cb, NULL); g_signal_handlers_disconnect_matched (send->composer, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, em_utils_composer_save_draft_cb, NULL); - + /* reconnect to the signals using a non-NULL emcs for the callback data */ em_composer_utils_setup_default_callbacks (send->composer); } - + e_msg_composer_set_enable_autosave (send->composer, TRUE); gtk_widget_show (GTK_WIDGET (send->composer)); } - + camel_message_info_free (info); - + if (send->emcs) emcs_unref (send->emcs); - + g_object_unref (send->composer); g_free (send); } @@ -262,23 +262,23 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) GList *postlist; EMEvent *eme; EMEventTargetComposer *target; - + gconf = mail_config_get_gconf_client (); - + /* We should do all of the validity checks based on the composer, and not on the created message, as extra interaction may occur when we get the message (e.g. to get a passphrase to sign a message) */ - + /* get the message recipients */ recipients = e_msg_composer_get_recipients (composer); - + cia = camel_internet_address_new (); - + /* see which ones are visible/present, etc */ if (recipients) { for (i = 0; recipients[i] != NULL; i++) { const char *addr = e_destination_get_address (recipients[i]); - + if (addr && addr[0]) { camel_address_decode ((CamelAddress *) cia, addr); if (camel_address_length ((CamelAddress *) cia) > 0) { @@ -294,12 +294,12 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) } } } - + recipients_bcc = e_msg_composer_get_bcc (composer); if (recipients_bcc) { for (i = 0; recipients_bcc[i] != NULL; i++) { const char *addr = e_destination_get_address (recipients_bcc[i]); - + if (addr && addr[0]) { camel_address_decode ((CamelAddress *) cia, addr); if (camel_address_length ((CamelAddress *) cia) > 0) { @@ -308,65 +308,65 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) } } } - + e_destination_freev (recipients_bcc); } - + camel_object_unref (cia); postlist = e_msg_composer_hdrs_get_post_to(e_msg_composer_get_hdrs (composer)); num_post = g_list_length(postlist); g_list_foreach(postlist, (GFunc)g_free, NULL); g_list_free(postlist); - + /* I'm sensing a lack of love, er, I mean recipients. */ if (num == 0 && num_post == 0) { e_error_run((GtkWindow *)composer, "mail:send-no-recipients", NULL); goto finished; } - + if (num > 0 && (num == num_bcc || shown == 0)) { - /* this means that the only recipients are Bcc's */ + /* this means that the only recipients are Bcc's */ if (!ask_confirm_for_only_bcc (composer, shown == 0)) goto finished; } - + send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL); confirm_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL); - + /* Only show this warning if our default is to send html. If it isn't, we've manually switched into html mode in the composer and (presumably) had a good reason for doing this. */ if (e_msg_composer_get_send_html (composer) && send_html && confirm_html) { gboolean html_problem = FALSE; - + if (recipients) { for (i = 0; recipients[i] != NULL && !html_problem; i++) { if (!e_destination_get_html_mail_pref (recipients[i])) html_problem = TRUE; } } - + if (html_problem) { html_problem = !ask_confirm_for_unwanted_html_mail (composer, recipients); if (html_problem) goto finished; } } - + /* Check for no subject */ subject = e_msg_composer_get_subject (composer); if (subject == NULL || subject[0] == '\0') { if (!ask_confirm_for_empty_subject (composer)) goto finished; } - + /** @Event: composer.presendchecks * @Title: Composer PreSend Checks * @Target: EMEventTargetMessage - * + * * composer.presendchecks is emitted during pre-checks for the message just before sending. - * Since the e-plugin framework doesn't provide a way to return a value from the plugin, + * Since the e-plugin framework doesn't provide a way to return a value from the plugin, * use 'presend_check_status' to set whether the check passed / failed. */ eme = em_event_peek(); @@ -382,10 +382,10 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) message = e_msg_composer_get_message (composer, save_html_object_data); if (message == NULL) goto finished; - + /* Add info about the sending account */ account = e_msg_composer_get_preferred_account (composer); - + if (account) { /* FIXME: Why isn't this crap just in e_msg_composer_get_message? */ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->uid); @@ -393,18 +393,18 @@ composer_get_message (EMsgComposer *composer, gboolean save_html_object_data) camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri); if (account->id->organization && *account->id->organization) { char *org; - + org = camel_header_encode_string ((const unsigned char *)account->id->organization); camel_medium_set_header (CAMEL_MEDIUM (message), "Organization", org); g_free (org); } } - + finished: - + if (recipients) e_destination_freev (recipients); - + return message; } @@ -428,11 +428,11 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data) mail_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX); camel_object_ref (mail_folder); - + /* mail the message */ info = camel_message_info_new(NULL); camel_message_info_set_flags(info, CAMEL_MESSAGE_SEEN, ~0); - + send = g_malloc (sizeof (*send)); send->emcs = user_data; if (send->emcs) @@ -443,7 +443,7 @@ em_utils_composer_send_cb (EMsgComposer *composer, gpointer user_data) gtk_widget_hide (GTK_WIDGET (composer)); e_msg_composer_set_enable_autosave (composer, FALSE); - + mail_append_mail (mail_folder, message, info, composer_send_queued_cb, send); camel_object_unref (mail_folder); camel_object_unref (message); @@ -462,23 +462,23 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i { struct _save_draft_info *sdi = user_data; struct emcs_t *emcs; - + if (!ok) goto done; e_msg_composer_set_saved (sdi->composer); - + if ((emcs = sdi->emcs) == NULL) { emcs = emcs_new (); - + /* disconnect the previous signal handlers */ g_signal_handlers_disconnect_by_func (sdi->composer, G_CALLBACK (em_utils_composer_send_cb), NULL); g_signal_handlers_disconnect_by_func (sdi->composer, G_CALLBACK (em_utils_composer_save_draft_cb), NULL); - + /* reconnect to the signals using a non-NULL emcs for the callback data */ em_composer_utils_setup_default_callbacks (sdi->composer); } - + if (emcs->drafts_folder) { /* delete the original draft message */ camel_folder_set_message_flags (emcs->drafts_folder, emcs->drafts_uid, @@ -489,7 +489,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i g_free (emcs->drafts_uid); emcs->drafts_uid = NULL; } - + if (emcs->folder) { /* set the replied flags etc */ camel_folder_set_message_flags (emcs->folder, emcs->uid, emcs->flags, emcs->set); @@ -498,16 +498,16 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i g_free (emcs->uid); emcs->uid = NULL; } - + if (appended_uid) { camel_object_ref (folder); emcs->drafts_folder = folder; emcs->drafts_uid = g_strdup (appended_uid); } - + if (sdi->quit) gtk_widget_destroy (GTK_WIDGET (sdi->composer)); - + done: g_object_unref (sdi->composer); if (sdi->emcs) @@ -520,7 +520,7 @@ static void save_draft_folder (char *uri, CamelFolder *folder, gpointer data) { CamelFolder **save = data; - + if (folder) { *save = folder; camel_object_ref (folder); @@ -556,10 +556,10 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user if (account && account->drafts_folder_uri && strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) { int id; - + id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_thread_new); mail_msg_wait (id); - + if (!folder || !account->enabled) { if (e_error_run((GtkWindow *)composer, "mail:ask-default-drafts", NULL) != GTK_RESPONSE_YES) { g_object_unref(composer); @@ -569,7 +569,7 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user g_free(sdi); return; } - + folder = drafts_folder; camel_object_ref (drafts_folder); } @@ -577,7 +577,7 @@ em_utils_composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user folder = drafts_folder; camel_object_ref (folder); } - + info = camel_message_info_new(NULL); camel_message_info_set_flags(info, CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN, ~0); @@ -591,9 +591,9 @@ em_composer_utils_setup_callbacks (EMsgComposer *composer, CamelFolder *folder, guint32 flags, guint32 set, CamelFolder *drafts, const char *drafts_uid) { struct emcs_t *emcs; - + emcs = emcs_new (); - + if (folder && uid) { camel_object_ref (folder); emcs->folder = folder; @@ -601,16 +601,16 @@ em_composer_utils_setup_callbacks (EMsgComposer *composer, CamelFolder *folder, emcs->flags = flags; emcs->set = set; } - + if (drafts && drafts_uid) { camel_object_ref (drafts); emcs->drafts_folder = drafts; emcs->drafts_uid = g_strdup (drafts_uid); } - + g_signal_connect (composer, "send", G_CALLBACK (em_utils_composer_send_cb), emcs); g_signal_connect (composer, "save-draft", G_CALLBACK (em_utils_composer_save_draft_cb), emcs); - + g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, emcs); } @@ -677,12 +677,12 @@ em_utils_compose_new_message_with_mailto (const char *url, const char *fromuri) { EMsgComposer *composer; EAccount *account = NULL; - + if (url != NULL) composer = e_msg_composer_new_from_url (url); else composer = e_msg_composer_new (); - + em_composer_utils_setup_default_callbacks (composer); if (fromuri @@ -691,7 +691,7 @@ em_utils_compose_new_message_with_mailto (const char *url, const char *fromuri) e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); - + gtk_widget_show ((GtkWidget *) composer); gdk_window_raise (((GtkWidget *) composer)->window); } @@ -709,28 +709,28 @@ em_utils_post_to_folder (CamelFolder *folder) { EMsgComposer *composer; EAccount *account; - + composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_POST); - + if (folder != NULL) { char *url = mail_tools_folder_to_url (folder); - + e_msg_composer_hdrs_set_post_to (e_msg_composer_get_hdrs (composer), url); g_free (url); - + url = camel_url_to_string (CAMEL_SERVICE (folder->parent_store)->url, CAMEL_URL_HIDE_ALL); account = mail_config_get_account_by_source_url (url); g_free (url); - + if (account) e_msg_composer_hdrs_set_from_account (e_msg_composer_get_hdrs(composer), account->name); } - + em_composer_utils_setup_default_callbacks (composer); - + e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); - + gtk_widget_show ((GtkWidget *) composer); } @@ -746,17 +746,17 @@ void em_utils_post_to_url (const char *url) { EMsgComposer *composer; - + composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_POST); - + if (url != NULL) e_msg_composer_hdrs_set_post_to (e_msg_composer_get_hdrs (composer), url); - + em_composer_utils_setup_default_callbacks (composer); - + e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); - + gtk_widget_show ((GtkWidget *) composer); } @@ -771,7 +771,7 @@ edit_message (CamelMimeMessage *message, CamelFolder *drafts, const char *uid) em_composer_utils_setup_callbacks (composer, NULL, NULL, 0, 0, drafts, uid); e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); - + gtk_widget_show (GTK_WIDGET (composer)); } @@ -786,7 +786,7 @@ void em_utils_edit_message (CamelMimeMessage *message) { g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - + edit_message (message, NULL, NULL); } @@ -795,13 +795,13 @@ edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *msgs, void *user { gboolean replace = GPOINTER_TO_INT (user_data); int i; - + if (msgs == NULL) return; - + for (i = 0; i < msgs->len; i++) { camel_medium_remove_header (CAMEL_MEDIUM (msgs->pdata[i]), "X-Mailer"); - + if (replace) edit_message (msgs->pdata[i], folder, uids->pdata[i]); else @@ -822,7 +822,7 @@ em_utils_edit_messages (CamelFolder *folder, GPtrArray *uids, gboolean replace) { g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - + mail_get_messages (folder, uids, edit_messages, GINT_TO_POINTER (replace)); } @@ -831,7 +831,7 @@ static void forward_attached (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, const char *fromuri) { EMsgComposer *composer; - + composer = create_new_composer (subject, fromuri); if (composer == NULL) return; @@ -839,7 +839,7 @@ forward_attached (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, e_msg_composer_attach (composer, part); e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); - + gtk_widget_show (GTK_WIDGET (composer)); } @@ -868,7 +868,7 @@ em_utils_forward_attached (CamelFolder *folder, GPtrArray *uids, const char *fro { g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - + mail_build_attachment (folder, uids, forward_attached_cb, g_strdup(fromuri)); } @@ -893,9 +893,9 @@ forward_non_attached (GPtrArray *messages, int style, const char *fromuri) message = messages->pdata[i]; subject = mail_tool_generate_forward_subject (message); - + text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL); - + if (text) { composer = create_new_composer (subject, fromuri); @@ -906,12 +906,12 @@ forward_non_attached (GPtrArray *messages, int style, const char *fromuri) e_msg_composer_set_body_text (composer, text, len); e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); - + gtk_widget_show (GTK_WIDGET (composer)); } g_free (text); } - + g_free (subject); } } @@ -936,7 +936,7 @@ em_utils_forward_inline (CamelFolder *folder, GPtrArray *uids, const char *fromu { g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - + mail_get_messages (folder, uids, forward_inline, g_strdup(fromuri)); } @@ -961,7 +961,7 @@ em_utils_forward_quoted (CamelFolder *folder, GPtrArray *uids, const char *fromu { g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - + mail_get_messages (folder, uids, forward_quoted, g_strdup(fromuri)); } @@ -981,20 +981,20 @@ em_utils_forward_message (CamelMimeMessage *message, const char *fromuri) GConfClient *gconf; char *subject; int mode; - + messages = g_ptr_array_new (); g_ptr_array_add (messages, message); - + gconf = mail_config_get_gconf_client (); mode = gconf_client_get_int (gconf, "/apps/evolution/mail/format/forward_style", NULL); - + switch (mode) { case MAIL_CONFIG_FORWARD_ATTACHED: default: part = mail_tool_make_message_attachment (message); - + subject = mail_tool_generate_forward_subject (message); - + forward_attached (NULL, messages, part, subject, fromuri); camel_object_unref (part); g_free (subject); @@ -1006,7 +1006,7 @@ em_utils_forward_message (CamelMimeMessage *message, const char *fromuri) forward_non_attached (messages, MAIL_CONFIG_FORWARD_QUOTED, fromuri); break; } - + g_ptr_array_free (messages, TRUE); } @@ -1023,10 +1023,10 @@ em_utils_forward_messages (CamelFolder *folder, GPtrArray *uids, const char *fro { GConfClient *gconf; int mode; - + gconf = mail_config_get_gconf_client (); mode = gconf_client_get_int (gconf, "/apps/evolution/mail/format/forward_style", NULL); - + switch (mode) { case MAIL_CONFIG_FORWARD_ATTACHED: default: @@ -1048,19 +1048,19 @@ redirect_get_composer (CamelMimeMessage *message) { EMsgComposer *composer; EAccount *account; - + /* QMail will refuse to send a message if it finds one of it's Delivered-To headers in the message, so remove all Delivered-To headers. Fixes bug #23635. */ while (camel_medium_get_header (CAMEL_MEDIUM (message), "Delivered-To")) camel_medium_remove_header (CAMEL_MEDIUM (message), "Delivered-To"); - + account = guess_account (message, NULL); - + composer = e_msg_composer_new_redirect (message, account ? account->name : NULL); - + em_composer_utils_setup_default_callbacks (composer); - + return composer; } @@ -1075,11 +1075,11 @@ void em_utils_redirect_message (CamelMimeMessage *message) { EMsgComposer *composer; - + g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - + composer = redirect_get_composer (message); - + gtk_widget_show (GTK_WIDGET (composer)); e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); @@ -1090,7 +1090,7 @@ redirect_msg (CamelFolder *folder, const char *uid, CamelMimeMessage *message, v { if (message == NULL) return; - + em_utils_redirect_message (message); } @@ -1107,7 +1107,7 @@ em_utils_redirect_message_by_uid (CamelFolder *folder, const char *uid) { g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uid != NULL); - + mail_get_message (folder, uid, redirect_msg, NULL, mail_thread_new); } @@ -1151,7 +1151,7 @@ em_utils_handle_receipt (CamelFolder *folder, const char *uid, CamelMimeMessage camel_message_info_set_user_flag(info, "receipt-handled", TRUE); camel_message_info_free(info); - + account = guess_account(msg, folder); /* TODO: should probably decode/format the address, it could be in rfc2047 format */ @@ -1161,7 +1161,7 @@ em_utils_handle_receipt (CamelFolder *folder, const char *uid, CamelMimeMessage while (camel_mime_is_lwsp(*addr)) addr++; } - + if (account && (account->receipt_policy == E_ACCOUNT_RECEIPT_ALWAYS || account->receipt_policy == E_ACCOUNT_RECEIPT_ASK) && e_error_run (NULL, "mail:ask-receipt", addr, camel_mime_message_get_subject(msg)) == GTK_RESPONSE_YES) em_utils_send_receipt(folder, msg); @@ -1187,7 +1187,7 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) CamelDataWrapper *receipt_text, *receipt_data; CamelContentType *type; CamelInternetAddress *addr; - CamelStream *stream; + CamelStream *stream; CamelFolder *out_folder; CamelMessageInfo *info; const char *message_id = camel_medium_get_header (CAMEL_MEDIUM (message), "Message-ID"); @@ -1201,27 +1201,27 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) if (!receipt_address) return; - + /* Collect information for the receipt */ - + /* We use camel_header_msgid_generate () to get a canonical * hostname, then skip the part leading to '@' */ hostname = strchr ((fake_msgid = camel_header_msgid_generate ()), '@'); hostname++; - + self_address = account->id->address; if (!message_id) message_id = ""; if (!message_date) message_date =""; - + /* Create toplevel container */ camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (body), "multipart/report;" "report-type=\"disposition-notification\""); - camel_multipart_set_boundary (body, NULL); - + camel_multipart_set_boundary (body, NULL); + /* Create textual receipt */ receipt_text = camel_data_wrapper_new (); type = camel_content_type_new ("text", "plain"); @@ -1234,20 +1234,20 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) self_address, message_subject, message_date); camel_data_wrapper_construct_from_stream (receipt_text, stream); camel_object_unref (stream); - + part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), receipt_text); camel_object_unref (receipt_text); camel_multipart_add_part (body, part); - camel_object_unref (part); - + camel_object_unref (part); + /* Create the machine-readable receipt */ receipt_data = camel_data_wrapper_new (); stream = camel_stream_mem_new (); part = camel_mime_part_new (); ua = g_strdup_printf ("%s; %s", hostname, "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT); - recipient = g_strdup_printf ("rfc822; %s", self_address); + recipient = g_strdup_printf ("rfc822; %s", self_address); type = camel_content_type_new ("message", "disposition-notification"); camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (part), type); @@ -1260,27 +1260,27 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) g_free (ua); g_free (recipient); g_free (fake_msgid); - + camel_data_wrapper_construct_from_stream (receipt_data, stream); camel_object_unref (stream); camel_medium_set_content_object (CAMEL_MEDIUM (part), receipt_data); camel_object_unref (receipt_data); camel_multipart_add_part (body, part); - camel_object_unref (part); - + camel_object_unref (part); + /* Finish creating the message */ camel_medium_set_content_object (CAMEL_MEDIUM (receipt), CAMEL_DATA_WRAPPER (body)); camel_object_unref (body); - + receipt_subject = g_strdup_printf ("Delivery Notification for: \"%s\"", message_subject); camel_mime_message_set_subject (receipt, receipt_subject); g_free (receipt_subject); - + addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (addr), self_address); camel_mime_message_set_from (receipt, addr); camel_object_unref (addr); - + addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (addr), receipt_address); camel_mime_message_set_recipients (receipt, CAMEL_RECIPIENT_TYPE_TO, addr); @@ -1288,11 +1288,11 @@ em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message) camel_medium_set_header (CAMEL_MEDIUM (receipt), "Return-Path", "<>"); if(account) { - camel_medium_set_header (CAMEL_MEDIUM (receipt), + camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Account", account->uid); - camel_medium_set_header (CAMEL_MEDIUM (receipt), + camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Transport", account->transport->url); - camel_medium_set_header (CAMEL_MEDIUM (receipt), + camel_medium_set_header (CAMEL_MEDIUM (receipt), "X-Evolution-Fcc", account->sent_folder_uri); } @@ -1312,19 +1312,19 @@ generate_account_hash (void) EAccount *account, *def; EAccountList *accounts; EIterator *iter; - + accounts = mail_config_get_accounts (); account_hash = g_hash_table_new (camel_strcase_hash, camel_strcase_equal); - + def = mail_config_get_default_account (); - + iter = e_list_get_iterator ((EList *) accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->id->address) { EAccount *acnt; - + /* Accounts with identical email addresses that are enabled * take precedence over the accounts that aren't. If all * accounts with matching email addresses are disabled, then @@ -1336,20 +1336,20 @@ generate_account_hash (void) g_hash_table_remove (account_hash, acnt->id->address); acnt = NULL; } - + if (!acnt) g_hash_table_insert (account_hash, (char *) account->id->address, (void *) account); } - + e_iterator_next (iter); } - + g_object_unref (iter); /* The default account has to be there if none of the enabled accounts are present */ if (g_hash_table_size (account_hash) == 0 && def && def->id->address) g_hash_table_insert (account_hash, (char *) def->id->address, (void *) def); - + return account_hash; } @@ -1358,33 +1358,33 @@ em_utils_camel_address_to_destination (CamelInternetAddress *iaddr) { EDestination *dest, **destv; int n, i, j; - + if (iaddr == NULL) return NULL; - + if ((n = camel_address_length ((CamelAddress *) iaddr)) == 0) return NULL; - + destv = g_malloc (sizeof (EDestination *) * (n + 1)); for (i = 0, j = 0; i < n; i++) { const char *name, *addr; - + if (camel_internet_address_get (iaddr, i, &name, &addr)) { dest = e_destination_new (); e_destination_set_name (dest, name); e_destination_set_email (dest, addr); - + destv[j++] = dest; } } - + if (j == 0) { g_free (destv); return NULL; } - + destv[j] = NULL; - + return destv; } @@ -1397,7 +1397,7 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account, EDestination **tov, **ccv; EMsgComposer *composer; char *subject; - + g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL); g_return_val_if_fail (to == NULL || CAMEL_IS_INTERNET_ADDRESS (to), NULL); g_return_val_if_fail (cc == NULL || CAMEL_IS_INTERNET_ADDRESS (cc), NULL); @@ -1425,9 +1425,9 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account, } e_msg_composer_set_headers (composer, account ? account->name : NULL, tov, ccv, NULL, subject); - + g_free (subject); - + /* add post-to, if nessecary */ if (postto && camel_address_length((CamelAddress *)postto)) { char *store_url = NULL; @@ -1444,28 +1444,28 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account, g_free(post); g_free (store_url); } - + /* Add In-Reply-To and References. */ message_id = camel_medium_get_header (CAMEL_MEDIUM (message), "Message-Id"); references = camel_medium_get_header (CAMEL_MEDIUM (message), "References"); if (message_id) { char *reply_refs; - + e_msg_composer_add_header (composer, "In-Reply-To", message_id); - + if (references) reply_refs = g_strdup_printf ("%s %s", references, message_id); else reply_refs = g_strdup (message_id); - + e_msg_composer_add_header (composer, "References", reply_refs); g_free (reply_refs); } else if (references) { e_msg_composer_add_header (composer, "References", references); } - + e_msg_composer_drop_editor_undo (composer); - + return composer; } @@ -1501,7 +1501,7 @@ guess_account (CamelMimeMessage *message, CamelFolder *folder) account_hash = generate_account_hash (); for (j=0;account == NULL && j<2;j++) { const CamelInternetAddress *to; - + to = camel_mime_message_get_recipients(message, types[j]); if (to) { for (i = 0; camel_internet_address_get(to, i, NULL, &tmp); i++) { @@ -1532,7 +1532,7 @@ get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTP const CamelInternetAddress *reply_to; const char *name, *addr, *posthdr; int i; - + /* check whether there is a 'Newsgroups: ' header in there */ if (postto && ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To")) @@ -1540,11 +1540,11 @@ get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTP camel_address_decode((CamelAddress *)postto, posthdr); return; } - + reply_to = camel_mime_message_get_reply_to (message); if (!reply_to) reply_to = camel_mime_message_get_from (message); - + if (reply_to) { for (i = 0; camel_internet_address_get (reply_to, i, &name, &addr); i++) camel_internet_address_add (to, name, addr); @@ -1556,38 +1556,38 @@ get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to) { const char *header, *p; char *addr; - + /* Examples: - * + * * List-Post: <mailto:list@host.com> * List-Post: <mailto:moderator@host.com?subject=list%20posting> * List-Post: NO (posting not allowed on this list) */ if (!(header = camel_medium_get_header ((CamelMedium *) message, "List-Post"))) return FALSE; - + while (*header == ' ' || *header == '\t') header++; - + /* check for NO */ if (!g_ascii_strncasecmp (header, "NO", 2)) return FALSE; - + /* Search for the first mailto angle-bracket enclosed URL. * (See rfc2369, Section 2, paragraph 3 for details) */ if (!(header = camel_strstrcase (header, "<mailto:"))) return FALSE; - + header += 8; - + p = header; while (*p && !strchr ("?>", *p)) p++; - - addr = g_strndup (header, p - header); + + addr = g_strndup (header, p - header); camel_internet_address_add(to, NULL, addr); g_free (addr); - + return TRUE; } @@ -1596,7 +1596,7 @@ concat_unique_addrs (CamelInternetAddress *dest, const CamelInternetAddress *src { const char *name, *addr; int i; - + for (i = 0; camel_internet_address_get (src, i, &name, &addr); i++) { if (!g_hash_table_lookup (rcpt_hash, addr)) { camel_internet_address_add (dest, name, addr); @@ -1612,7 +1612,7 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne const char *name, *addr, *posthdr; GHashTable *rcpt_hash; int i; - + /* check whether there is a 'Newsgroups: ' header in there */ if (postto) { if ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To"))) @@ -1620,16 +1620,16 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne if ((posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups"))) camel_address_decode((CamelAddress *)postto, posthdr); } - + rcpt_hash = generate_account_hash (); - + reply_to = camel_mime_message_get_reply_to (message); if (!reply_to) reply_to = camel_mime_message_get_from (message); - + to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); - + if (reply_to) { for (i = 0; camel_internet_address_get (reply_to, i, &name, &addr); i++) { /* ignore references to the Reply-To address in the To and Cc lists */ @@ -1637,16 +1637,16 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne /* In the case that we are doing a Reply-To-All, we do not want to include the user's email address because replying to oneself is kinda silly. */ - + camel_internet_address_add (to, name, addr); g_hash_table_insert (rcpt_hash, (char *) addr, GINT_TO_POINTER (1)); } } } - + concat_unique_addrs (cc, to_addrs, rcpt_hash); concat_unique_addrs (cc, cc_addrs, rcpt_hash); - + /* promote the first Cc: address to To: if To: is empty */ if (camel_address_length ((CamelAddress *) to) == 0 && camel_address_length ((CamelAddress *)cc) > 0) { camel_internet_address_get (cc, 0, &name, &addr); @@ -1660,7 +1660,7 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne || camel_internet_address_get(cc_addrs, 0, &name, &addr))) { camel_internet_address_add(to, name, addr); } - + g_hash_table_destroy (rcpt_hash); } @@ -1688,14 +1688,14 @@ format_sender (GString *str, const char *attr, CamelMimeMessage *message) { const CamelInternetAddress *sender; const char *name, *addr; - + sender = camel_mime_message_get_from (message); if (sender != NULL && camel_address_length (CAMEL_ADDRESS (sender)) > 0) { camel_internet_address_get (sender, 0, &name, &addr); } else { name = _("an unknown sender"); } - + if (name && !strcmp (attr, "{SenderName}")) { g_string_append (str, name); } else if (addr && !strcmp (attr, "{SenderEMail}")) { @@ -1753,9 +1753,9 @@ attribution_format (const char *format, CamelMimeMessage *message) struct tm tm; time_t date; int type; - + str = g_string_new (""); - + date = camel_mime_message_get_date (message, &tzone); if (date == CAMEL_MESSAGE_DATE_CURRENT) { @@ -1767,35 +1767,35 @@ attribution_format (const char *format, CamelMimeMessage *message) time (&date); tzone = 0; } - + /* Convert to UTC */ date += (tzone / 100) * 60 * 60; date += (tzone % 100) * 60; - + gmtime_r (&date, &tm); - + start = inptr = format; while (*inptr != '\0') { start = inptr; while (*inptr && strncmp (inptr, "${", 2) != 0) inptr++; - + g_string_append_len (str, start, inptr - start); - + if (*inptr == '\0') break; - + start = ++inptr; while (*inptr && *inptr != '}') inptr++; - + if (*inptr != '}') { /* broken translation */ g_string_append_len (str, "${", 2); inptr = start + 1; continue; } - + inptr++; len = inptr - start; type = ATTRIB_UNKNOWN; @@ -1805,7 +1805,7 @@ attribution_format (const char *format, CamelMimeMessage *message) break; } } - + switch (type) { case ATTRIB_CUSTOM: attribvars[i].v.formatter (str, attribvars[i].name, message); @@ -1853,10 +1853,10 @@ attribution_format (const char *format, CamelMimeMessage *message) break; } } - + s = str->str; g_string_free (str, FALSE); - + return s; } @@ -1867,9 +1867,9 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat * CamelMimePart *part; GConfClient *gconf; ssize_t len; - + gconf = mail_config_get_gconf_client (); - + switch (gconf_client_get_int (gconf, "/apps/evolution/mail/format/reply_style", NULL)) { case MAIL_CONFIG_REPLY_DO_NOT_QUOTE: /* do nothing */ @@ -1896,7 +1896,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat * g_free (text); break; } - + e_msg_composer_drop_editor_undo (composer); } @@ -1963,7 +1963,7 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage /** @Event: message.replying * @Title: Message being replied to * @Target: EMEventTargetMessage - * + * * message.replying is emitted when a user starts replying to a message. */ @@ -1974,10 +1974,10 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage to = camel_internet_address_new(); cc = camel_internet_address_new(); - + account = guess_account (message, folder); flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN; - + switch (mode) { case REPLY_MODE_SENDER: if (folder) @@ -1998,7 +1998,7 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage get_reply_all(message, to, cc, postto); break; } - + composer = reply_get_composer (message, account, to, cc, folder, postto); e_msg_composer_add_message_attachments (composer, message, TRUE); @@ -2006,11 +2006,11 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage camel_object_unref(postto); camel_object_unref(to); camel_object_unref(cc); - + composer_set_body (composer, message, source); - + em_composer_utils_setup_callbacks (composer, folder, uid, flags, flags, NULL, NULL); - + gtk_widget_show (GTK_WIDGET (composer)); e_msg_composer_unset_changed (composer); } @@ -2030,13 +2030,13 @@ post_reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *m EAccount *account; char *real_uid; guint32 flags; - + if (message == NULL) return; - + if (CAMEL_IS_VEE_FOLDER (folder)) { CamelMessageInfo *info; - + info = camel_folder_get_message_info (folder, uid); real_folder = camel_vee_folder_get_location ((CamelVeeFolder *) folder, (struct _CamelVeeMessageInfo *) info, &real_uid); camel_folder_free_message_info (folder, info); @@ -2045,18 +2045,18 @@ post_reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *m camel_object_ref (folder); real_uid = g_strdup (uid); } - + account = guess_account (message, real_folder); flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN; - + to = camel_internet_address_new(); get_reply_sender (message, to, NULL); - + composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_MAIL_POST); - + /* construct the tov/ccv */ tov = em_utils_camel_address_to_destination (to); - + /* Set the subject of the new message. */ if ((subject = (char *) camel_mime_message_get_subject (message))) { if (g_ascii_strncasecmp (subject, "Re: ", 4) != 0) @@ -2066,45 +2066,45 @@ post_reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *m } else { subject = g_strdup (""); } - + e_msg_composer_set_headers (composer, account ? account->name : NULL, tov, NULL, NULL, subject); - + g_free (subject); - + url = mail_tools_folder_to_url (real_folder); e_msg_composer_hdrs_set_post_to (e_msg_composer_get_hdrs(composer), url); g_free (url); - + /* Add In-Reply-To and References. */ message_id = camel_medium_get_header (CAMEL_MEDIUM (message), "Message-Id"); references = camel_medium_get_header (CAMEL_MEDIUM (message), "References"); if (message_id) { char *reply_refs; - + e_msg_composer_add_header (composer, "In-Reply-To", message_id); - + if (references) reply_refs = g_strdup_printf ("%s %s", references, message_id); else reply_refs = g_strdup (message_id); - + e_msg_composer_add_header (composer, "References", reply_refs); g_free (reply_refs); } else if (references) { e_msg_composer_add_header (composer, "References", references); } - + e_msg_composer_drop_editor_undo (composer); - + e_msg_composer_add_message_attachments (composer, message, TRUE); - + composer_set_body (composer, message, NULL); - + em_composer_utils_setup_callbacks (composer, real_folder, real_uid, flags, flags, NULL, NULL); - - gtk_widget_show (GTK_WIDGET (composer)); + + gtk_widget_show (GTK_WIDGET (composer)); e_msg_composer_unset_changed (composer); - + camel_object_unref (real_folder); camel_object_unref(to); g_free (real_uid); @@ -2124,6 +2124,6 @@ em_utils_post_reply_to_message_by_uid (CamelFolder *folder, const char *uid) { g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uid != NULL); - + mail_get_message (folder, uid, post_reply_to_message, NULL, mail_thread_new); } diff --git a/mail/em-config.c b/mail/em-config.c index ef3f793563..80869faa4b 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -104,7 +104,7 @@ emp_target_free(EConfig *ep, EConfigTarget *t) break; } case EM_CONFIG_TARGET_ACCOUNT: { EMConfigTargetAccount *s = (EMConfigTargetAccount *)t; - + if (((EMConfig *)ep)->priv->account_changed_id) { g_signal_handler_disconnect(s->account, ((EMConfig *)ep)->priv->account_changed_id); ((EMConfig *)ep)->priv->account_changed_id = 0; @@ -157,7 +157,7 @@ emp_set_target(EConfig *ep, EConfigTarget *t) break; } case EM_CONFIG_TARGET_ACCOUNT: { EMConfigTargetAccount *s = (EMConfigTargetAccount *)t; - + ((EMConfig *)ep)->priv->account_changed_id = g_signal_connect(s->account, "changed", G_CALLBACK(emp_account_changed), ep); break; } } @@ -306,7 +306,7 @@ GType em_config_hook_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMConfigHookClass), NULL, NULL, (GClassInitFunc) emph_class_init, NULL, NULL, @@ -316,6 +316,6 @@ em_config_hook_get_type(void) emph_parent_class = g_type_class_ref(e_config_hook_get_type()); type = g_type_register_static(e_config_hook_get_type(), "EMConfigHook", &info, 0); } - + return type; } diff --git a/mail/em-event.c b/mail/em-event.c index a690c25763..173d7d18fd 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -80,7 +80,7 @@ eme_target_free(EEvent *ep, EEventTarget *t) break; } case EM_EVENT_TARGET_COMPOSER : { EMEventTargetComposer *s = (EMEventTargetComposer *)t; - + if (s->composer) g_object_unref (s->composer); break; } @@ -119,11 +119,11 @@ em_event_get_type(void) /** * em_event_peek: - * @void: - * + * @void: + * * Get the singular instance of the mail event handler. - * - * Return value: + * + * Return value: **/ EMEvent *em_event_peek(void) { @@ -249,7 +249,7 @@ GType em_event_hook_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMEventHookClass), NULL, NULL, (GClassInitFunc) emeh_class_init, NULL, NULL, @@ -259,6 +259,6 @@ em_event_hook_get_type(void) emeh_parent_class = g_type_class_ref(e_event_hook_get_type()); type = g_type_register_static(e_event_hook_get_type(), "EMEventHook", &info, 0); } - + return type; } diff --git a/mail/em-event.h b/mail/em-event.h index 4279565c19..3db64e8cb4 100644 --- a/mail/em-event.h +++ b/mail/em-event.h @@ -98,7 +98,7 @@ typedef struct _EMEventTargetSendReceive EMEventTargetSendReceive; struct _EMEventTargetSendReceive { EEventTarget target; - + struct _GtkWidget *table; gpointer data; int row; diff --git a/mail/em-filter-context.c b/mail/em-filter-context.c index 75b7e6a605..6c11261d12 100644 --- a/mail/em-filter-context.c +++ b/mail/em-filter-context.c @@ -35,7 +35,7 @@ /* For poking into filter-folder guts */ #include "em-filter-folder-element.h" -#define d(x) +#define d(x) static void em_filter_context_class_init(EMFilterContextClass *klass); static void em_filter_context_init(EMFilterContext *fc); @@ -51,7 +51,7 @@ GType em_filter_context_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMFilterContextClass), @@ -64,10 +64,10 @@ em_filter_context_get_type(void) 0, /* n_preallocs */ (GInstanceInitFunc) em_filter_context_init, }; - + type = g_type_register_static(RULE_TYPE_CONTEXT, "EMFilterContext", &info, 0); } - + return type; } @@ -76,11 +76,11 @@ em_filter_context_class_init(EMFilterContextClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); RuleContextClass *rc_class = RULE_CONTEXT_CLASS(klass); - + parent_class = g_type_class_ref(RULE_TYPE_CONTEXT); - + object_class->finalize = em_filter_context_finalise; - + /* override methods */ rc_class->rename_uri = filter_rename_uri; rc_class->delete_uri = filter_delete_uri; @@ -95,7 +95,7 @@ em_filter_context_init(EMFilterContext *fc) rule_context_add_part_set((RuleContext *) fc, "actionset", filter_part_get_type(), (RCPartFunc) em_filter_context_add_action, (RCNextPartFunc) em_filter_context_next_action); - + rule_context_add_rule_set((RuleContext *) fc, "ruleset", em_filter_rule_get_type(), (RCRuleFunc) rule_context_add_rule, rule_context_next_rule); } @@ -104,10 +104,10 @@ static void em_filter_context_finalise(GObject *obj) { EMFilterContext *fc = (EMFilterContext *)obj; - + g_list_foreach(fc->actions, (GFunc)g_object_unref, NULL); g_list_free(fc->actions); - + G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -115,7 +115,7 @@ em_filter_context_finalise(GObject *obj) * em_filter_context_new: * * Create a new EMFilterContext object. - * + * * Return value: A new #EMFilterContext object. **/ EMFilterContext * @@ -142,10 +142,10 @@ FilterPart * em_filter_context_create_action(EMFilterContext *fc, const char *name) { FilterPart *part; - + if ((part = em_filter_context_find_action(fc, name))) return filter_part_clone(part); - + return NULL; } @@ -165,33 +165,33 @@ filter_rename_uri(RuleContext *rc, const char *olduri, const char *newuri, GComp FilterElement *element; int count = 0; GList *changed = NULL; - + d(printf("uri '%s' renamed to '%s'\n", olduri, newuri)); - + /* For all rules, for all actions, for all elements, rename any folder elements */ /* Yes we could do this inside each part itself, but not today */ rule = NULL; while ((rule = rule_context_next_rule(rc, rule, NULL))) { int rulecount = 0; - + d(printf("checking rule '%s'\n", rule->name)); - + l = EM_FILTER_RULE(rule)->actions; while (l) { action = l->data; - + d(printf("checking action '%s'\n", action->name)); - + el = action->elements; while (el) { element = el->data; - + d(printf("checking element '%s'\n", element->name)); if (EM_IS_FILTER_FOLDER_ELEMENT(element)) { d(printf(" is folder, existing uri = '%s'\n", FILTER_FOLDER(element)->uri)); } - + if (EM_IS_FILTER_FOLDER_ELEMENT(element) && cmp(((EMFilterFolderElement *)element)->uri, olduri)) { d(printf(" Changed!\n")); @@ -202,17 +202,17 @@ filter_rename_uri(RuleContext *rc, const char *olduri, const char *newuri, GComp } l = l->next; } - + if (rulecount) { changed = g_list_append(changed, g_strdup(rule->name)); filter_rule_emit_changed(rule); } - + count += rulecount; } - + /* might need to call parent class, if it did anything ... parent_class->rename_uri(f, olduri, newuri, cmp); */ - + return changed; } @@ -221,40 +221,40 @@ filter_delete_uri(RuleContext *rc, const char *uri, GCompareFunc cmp) { /* We basically do similar to above, but when we find it, Remove the action, and if thats the last action, this might create an empty rule? remove the rule? */ - + FilterRule *rule; GList *l, *el; FilterPart *action; FilterElement *element; int count = 0; GList *deleted = NULL; - + d(printf("uri '%s' deleted\n", uri)); - + /* For all rules, for all actions, for all elements, check deleted folder elements */ /* Yes we could do this inside each part itself, but not today */ rule = NULL; while ((rule = rule_context_next_rule(rc, rule, NULL))) { int recorded = 0; - + d(printf("checking rule '%s'\n", rule->name)); - + l = EM_FILTER_RULE(rule)->actions; while (l) { action = l->data; - + d(printf("checking action '%s'\n", action->name)); - + el = action->elements; while (el) { element = el->data; - + d(printf("checking element '%s'\n", element->name)); if (EM_IS_FILTER_FOLDER_ELEMENT(element)) { d(printf(" is folder, existing uri = '%s'\n", FILTER_FOLDER(element)->uri)); } - + if (EM_IS_FILTER_FOLDER_ELEMENT(element) && cmp(((EMFilterFolderElement *)element)->uri, uri)) { d(printf(" Deleted!\n")); @@ -274,9 +274,9 @@ filter_delete_uri(RuleContext *rc, const char *uri, GCompareFunc cmp) ; } } - + /* TODO: could call parent and merge lists */ - + return deleted; } diff --git a/mail/em-filter-context.h b/mail/em-filter-context.h index f2a5581f8b..051e600bd7 100644 --- a/mail/em-filter-context.h +++ b/mail/em-filter-context.h @@ -37,7 +37,7 @@ typedef struct _EMFilterContextClass EMFilterContextClass; struct _EMFilterContext { RuleContext parent_object; - + GList *actions; }; diff --git a/mail/em-filter-editor.c b/mail/em-filter-editor.c index 4c5703dcd9..aff4bda747 100644 --- a/mail/em-filter-editor.c +++ b/mail/em-filter-editor.c @@ -49,7 +49,7 @@ GtkType em_filter_editor_get_type (void) { static GtkType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMFilterEditorClass), @@ -62,10 +62,10 @@ em_filter_editor_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) em_filter_editor_init, }; - + type = g_type_register_static (RULE_TYPE_EDITOR, "EMFilterEditor", &info, 0); } - + return type; } @@ -74,11 +74,11 @@ em_filter_editor_class_init (EMFilterEditorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); RuleEditorClass *re_class = (RuleEditorClass *) klass; - + parent_class = g_type_class_ref (rule_editor_get_type ()); - + gobject_class->finalize = em_filter_editor_finalise; - + /* override methods */ re_class->create_rule = create_rule; } @@ -99,7 +99,7 @@ em_filter_editor_finalise (GObject *obj) * em_filter_editor_new: * * Create a new EMFilterEditor object. - * + * * Return value: A new #EMFilterEditor object. **/ EMFilterEditor * @@ -117,7 +117,7 @@ em_filter_editor_new (EMFilterContext *fc, const EMFilterSource *source_names) em_filter_editor_construct (fe, fc, gui, source_names); g_object_unref (gui); - + return fe; } @@ -125,10 +125,10 @@ static void select_source (GtkMenuItem *mi, EMFilterEditor *fe) { char *source; - + source = g_object_get_data(G_OBJECT(mi), "source"); g_return_if_fail (source); - + rule_editor_set_source ((RuleEditor *)fe, source); } @@ -137,11 +137,11 @@ em_filter_editor_construct (EMFilterEditor *fe, EMFilterContext *fc, GladeXML *g { GtkWidget *menu, *item, *omenu; int i; - + omenu = glade_xml_get_widget (gui, "filter_source"); gtk_option_menu_remove_menu (GTK_OPTION_MENU (omenu)); menu = gtk_menu_new (); - + for (i = 0; source_names[i].source; i++) { item = gtk_menu_item_new_with_label(source_names[i].name); g_object_set_data_full((GObject *)item, "source", g_strdup(source_names[i].source), g_free); @@ -151,7 +151,7 @@ em_filter_editor_construct (EMFilterEditor *fe, EMFilterContext *fc, GladeXML *g } gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); gtk_widget_show (omenu); - + rule_editor_construct ((RuleEditor *) fe, (RuleContext *) fc, gui, source_names[0].source, _("_Filter Rules")); } @@ -160,13 +160,13 @@ create_rule (RuleEditor *re) { FilterRule *rule = filter_rule_new (); FilterPart *part; - + /* create a rule with 1 part & 1 action in it */ rule = (FilterRule *)em_filter_rule_new (); part = rule_context_next_part (re->context, NULL); filter_rule_add_part (rule, filter_part_clone (part)); part = em_filter_context_next_action ((EMFilterContext *)re->context, NULL); em_filter_rule_add_action ((EMFilterRule *)rule, filter_part_clone (part)); - + return rule; } diff --git a/mail/em-filter-folder-element.c b/mail/em-filter-folder-element.c index 0b038294a2..e159296640 100644 --- a/mail/em-filter-folder-element.c +++ b/mail/em-filter-folder-element.c @@ -58,7 +58,7 @@ GType em_filter_folder_element_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMFilterFolderElementClass), @@ -71,10 +71,10 @@ em_filter_folder_element_get_type(void) 0, /* n_preallocs */ (GInstanceInitFunc)em_filter_folder_element_init, }; - + type = g_type_register_static(FILTER_TYPE_ELEMENT, "EMFilterFolderElement", &info, 0); } - + return type; } @@ -83,11 +83,11 @@ em_filter_folder_element_class_init(EMFilterFolderElementClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); FilterElementClass *fe_class = FILTER_ELEMENT_CLASS(klass); - + parent_class = g_type_class_ref(FILTER_TYPE_ELEMENT); - + object_class->finalize = em_filter_folder_element_finalise; - + /* override methods */ fe_class->validate = validate; fe_class->eq = folder_eq; @@ -110,9 +110,9 @@ static void em_filter_folder_element_finalise(GObject *obj) { EMFilterFolderElement *ff = (EMFilterFolderElement *)obj; - + g_free(ff->uri); - + G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -120,7 +120,7 @@ em_filter_folder_element_finalise(GObject *obj) * em_filter_folder_element_new: * * Create a new EMFilterFolderElement object. - * + * * Return value: A new #EMFilterFolderElement object. **/ EMFilterFolderElement * @@ -140,7 +140,7 @@ static gboolean validate(FilterElement *fe) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; - + if (ff->uri && *ff->uri) { return TRUE; } else { @@ -173,16 +173,16 @@ xml_encode(FilterElement *fe) { xmlNodePtr value, work; EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; - + d(printf("Encoding folder as xml\n")); - + value = xmlNewNode(NULL, (unsigned const char *)"value"); xmlSetProp(value, (unsigned const char *)"name", (unsigned char *)fe->name); xmlSetProp(value, (unsigned const char *)"type", (unsigned const char *)"folder"); - + work = xmlNewChild(value, NULL, (unsigned const char *)"folder", NULL); xmlSetProp(work, (unsigned const char *)"uri", (unsigned const char *)ff->uri); - + return value; } @@ -191,17 +191,17 @@ xml_decode(FilterElement *fe, xmlNodePtr node) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; xmlNodePtr n; - + d(printf("Decoding folder from xml %p\n", fe)); - + xmlFree(fe->name); fe->name = (char *)xmlGetProp(node, (unsigned const char *)"name"); - + n = node->children; while(n) { if (!strcmp((char *)n->name, "folder")) { char *uri; - + uri = (char *)xmlGetProp(n, (unsigned const char *)"uri"); g_free(ff->uri); ff->uri = g_strdup(uri); @@ -210,7 +210,7 @@ xml_decode(FilterElement *fe, xmlNodePtr node) } n = n->next; } - + return 0; } @@ -222,7 +222,7 @@ folder_selected(EMFolderSelectionButton *button, EMFilterFolderElement *ff) uri = em_folder_selection_button_get_selection(button); g_free(ff->uri); ff->uri = uri!=NULL?em_uri_from_camel(uri):NULL; - + gdk_window_raise(GTK_WIDGET(gtk_widget_get_ancestor(GTK_WIDGET(button), GTK_TYPE_WINDOW))->window); } @@ -237,10 +237,10 @@ get_widget(FilterElement *fe) button = em_folder_selection_button_new(_("Select Folder"), NULL); em_folder_selection_button_set_selection(EM_FOLDER_SELECTION_BUTTON(button), uri); g_free(uri); - + gtk_widget_show(button); g_signal_connect(button, "selected", G_CALLBACK(folder_selected), ff); - + return button; } @@ -254,7 +254,7 @@ static void format_sexp(FilterElement *fe, GString *out) { EMFilterFolderElement *ff = (EMFilterFolderElement *)fe; - + e_sexp_encode_string(out, ff->uri); } diff --git a/mail/em-filter-folder-element.h b/mail/em-filter-folder-element.h index f59d76c901..042ab5d504 100644 --- a/mail/em-filter-folder-element.h +++ b/mail/em-filter-folder-element.h @@ -36,7 +36,7 @@ typedef struct _EMFilterFolderElementClass EMFilterFolderElementClass; struct _EMFilterFolderElement { FilterElement parent_object; - + char *uri; }; diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c index 1815e0dcdb..aaec41ba3b 100644 --- a/mail/em-filter-rule.c +++ b/mail/em-filter-rule.c @@ -52,7 +52,7 @@ GType em_filter_rule_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMFilterRuleClass), @@ -65,10 +65,10 @@ em_filter_rule_get_type(void) 0, /* n_preallocs */ (GInstanceInitFunc)em_filter_rule_init, }; - + type = g_type_register_static(FILTER_TYPE_RULE, "EMFilterRule", &info, 0); } - + return type; } @@ -77,11 +77,11 @@ em_filter_rule_class_init(EMFilterRuleClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); FilterRuleClass *fr_class =(FilterRuleClass *)klass; - + parent_class = g_type_class_ref(FILTER_TYPE_RULE); - + object_class->finalize = em_filter_rule_finalise; - + /* override methods */ fr_class->validate = validate; fr_class->eq = filter_eq; @@ -111,10 +111,10 @@ static void em_filter_rule_finalise(GObject *obj) { EMFilterRule *ff =(EMFilterRule *) obj; - + unref_list(ff->actions); g_list_free(ff->actions); - + G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -122,7 +122,7 @@ em_filter_rule_finalise(GObject *obj) * em_filter_rule_new: * * Create a new EMFilterRule object. - * + * * Return value: A new #EMFilterRule object. **/ EMFilterRule * @@ -135,7 +135,7 @@ void em_filter_rule_add_action(EMFilterRule *fr, FilterPart *fp) { fr->actions = g_list_append(fr->actions, fp); - + filter_rule_emit_changed((FilterRule *)fr); } @@ -143,7 +143,7 @@ void em_filter_rule_remove_action(EMFilterRule *fr, FilterPart *fp) { fr->actions = g_list_remove(fr->actions, fp); - + filter_rule_emit_changed((FilterRule *)fr); } @@ -151,14 +151,14 @@ void em_filter_rule_replace_action(EMFilterRule *fr, FilterPart *fp, FilterPart *new) { GList *l; - + l = g_list_find(fr->actions, fp); if (l) { l->data = new; } else { fr->actions = g_list_append(fr->actions, new); } - + filter_rule_emit_changed((FilterRule *)fr); } @@ -176,16 +176,16 @@ validate(FilterRule *fr) EMFilterRule *ff =(EMFilterRule *)fr; GList *parts; int valid; - + valid = FILTER_RULE_CLASS(parent_class)->validate(fr); - + /* validate rule actions */ parts = ff->actions; while (parts && valid) { valid = filter_part_validate((FilterPart *)parts->data); parts = parts->next; } - + return valid; } @@ -193,15 +193,15 @@ static int list_eq(GList *al, GList *bl) { int truth = TRUE; - + while (truth && al && bl) { FilterPart *a = al->data, *b = bl->data; - + truth = filter_part_eq(a, b); al = al->next; bl = bl->next; } - + return truth && al == NULL && bl == NULL; } @@ -218,7 +218,7 @@ xml_encode(FilterRule *fr) EMFilterRule *ff =(EMFilterRule *)fr; xmlNodePtr node, set, work; GList *l; - + node = FILTER_RULE_CLASS(parent_class)->xml_encode(fr); g_return_val_if_fail (node != NULL, NULL); set = xmlNewNode(NULL, (const unsigned char *)"actionset"); @@ -229,7 +229,7 @@ xml_encode(FilterRule *fr) xmlAddChild(set, work); l = l->next; } - + return node; } @@ -240,7 +240,7 @@ load_set(xmlNodePtr node, EMFilterRule *ff, RuleContext *rc) xmlNodePtr work; char *rulename; FilterPart *part; - + work = node->children; while (work) { if (!strcmp((char *)work->name, "part")) { @@ -267,11 +267,11 @@ xml_decode(FilterRule *fr, xmlNodePtr node, RuleContext *rc) EMFilterRule *ff =(EMFilterRule *)fr; xmlNodePtr work; int result; - + result = FILTER_RULE_CLASS(parent_class)->xml_decode(fr, node, rc); if (result != 0) return result; - + work = node->children; while (work) { if (!strcmp((char *)work->name, "actionset")) { @@ -279,7 +279,7 @@ xml_decode(FilterRule *fr, xmlNodePtr node, RuleContext *rc) } work = work->next; } - + return 0; } @@ -288,25 +288,25 @@ rule_copy(FilterRule *dest, FilterRule *src) { EMFilterRule *fdest, *fsrc; GList *node; - + fdest =(EMFilterRule *)dest; fsrc =(EMFilterRule *)src; - + if (fdest->actions) { g_list_foreach(fdest->actions, (GFunc)g_object_unref, NULL); g_list_free(fdest->actions); fdest->actions = NULL; } - + node = fsrc->actions; while (node) { FilterPart *part = node->data; - + g_object_ref(part); fdest->actions = g_list_append(fdest->actions, part); node = node->next; } - + FILTER_RULE_CLASS(parent_class)->copy(dest, src); } @@ -327,16 +327,16 @@ option_activate(GtkMenuItem *item, struct _part_data *data) { FilterPart *part = g_object_get_data((GObject *)item, "part"); FilterPart *newpart; - + /* dont update if we haven't changed */ if (!strcmp(part->title, data->part->title)) return; - + /* here we do a widget shuffle, throw away the old widget/rulepart, and create another */ if (data->partwidget) gtk_container_remove(GTK_CONTAINER(data->container), data->partwidget); - + newpart = filter_part_clone(part); filter_part_copy_values(newpart, data->part); em_filter_rule_replace_action((EMFilterRule *)data->fr, data->part, newpart); @@ -345,7 +345,7 @@ option_activate(GtkMenuItem *item, struct _part_data *data) data->partwidget = filter_part_get_widget(newpart); if (data->partwidget) gtk_box_pack_start(GTK_BOX(data->container), data->partwidget, TRUE, TRUE, 0); - + g_object_set_data((GObject *)data->container, "part", newpart); } @@ -360,44 +360,44 @@ get_rule_part_widget(EMFilterContext *f, FilterPart *newpart, FilterRule *fr) GtkWidget *p; int index = 0, current = 0; struct _part_data *data; - + data = g_malloc0(sizeof(*data)); data->fr = fr; data->f = f; data->part = newpart; - + hbox = gtk_hbox_new(FALSE, 0); p = filter_part_get_widget(newpart); - + data->partwidget = p; data->container = hbox; - + menu = gtk_menu_new(); while ((part = em_filter_context_next_action(f, part))) { item = gtk_menu_item_new_with_label(_(part->title)); - + g_object_set_data((GObject *)item, "part", part); g_signal_connect(item, "activate", G_CALLBACK(option_activate), data); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); gtk_widget_show(item); - + if (!strcmp(newpart->title, part->title)) current = index; - + index++; } - + omenu = gtk_option_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), current); gtk_widget_show(omenu); - + gtk_box_pack_start(GTK_BOX(hbox), omenu, FALSE, FALSE, 0); if (p) gtk_box_pack_start(GTK_BOX(hbox), p, TRUE, TRUE, 0); - + gtk_widget_show_all(hbox); - + return hbox; } @@ -413,18 +413,18 @@ less_parts(GtkWidget *button, struct _rule_data *data) FilterPart *part; GtkWidget *rule; GList *l; - + l =((EMFilterRule *)data->fr)->actions; if (g_list_length(l) < 2) return; - + rule = g_object_get_data((GObject *)button, "rule"); part = g_object_get_data((GObject *)rule, "part"); - + /* remove the part from the list */ em_filter_rule_remove_action((EMFilterRule *)data->fr, part); g_object_unref(part); - + /* and from the display */ gtk_container_remove(GTK_CONTAINER(data->parts), rule); gtk_container_remove(GTK_CONTAINER(data->parts), button); @@ -434,10 +434,10 @@ static void attach_rule(GtkWidget *rule, struct _rule_data *data, FilterPart *part, int row) { GtkWidget *remove; - + gtk_table_attach(GTK_TABLE(data->parts), rule, 0, 1, row, row + 1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - + remove = gtk_button_new_from_stock(GTK_STOCK_REMOVE); g_object_set_data((GObject *)remove, "rule", rule); g_object_set_data((GObject *)rule, "part", part); @@ -452,17 +452,17 @@ static void more_parts(GtkWidget *button, struct _rule_data *data) { FilterPart *new; - + /* create a new rule entry, use the first type of rule */ new = em_filter_context_next_action((EMFilterContext *)data->f, NULL); if (new) { GtkWidget *w; guint16 rows; - + new = filter_part_clone(new); em_filter_rule_add_action((EMFilterRule *)data->fr, new); w = get_rule_part_widget(data->f, new, data->fr); - + rows = GTK_TABLE(data->parts)->nrows; gtk_table_resize(GTK_TABLE(data->parts), rows + 1, 2); attach_rule(w, data, new, rows); @@ -482,11 +482,11 @@ get_widget(FilterRule *fr, RuleContext *rc) EMFilterRule *ff =(EMFilterRule *)fr; int rows, i = 0; gchar *msg; - + widget = FILTER_RULE_CLASS(parent_class)->get_widget(fr, rc); - + /* and now for the action area */ - msg = g_strdup_printf("<b>%s</b>", _("Then")); + msg = g_strdup_printf("<b>%s</b>", _("Then")); label = gtk_label_new(msg); gtk_label_set_use_markup(GTK_LABEL(label), TRUE); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -504,24 +504,24 @@ get_widget(FilterRule *fr, RuleContext *rc) inframe = gtk_vbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(hbox), inframe, TRUE, TRUE, 0); - + rows = g_list_length(ff->actions); parts = gtk_table_new(rows, 2, FALSE); data = g_malloc0(sizeof(*data)); data->f =(EMFilterContext *)rc; data->fr = fr; data->parts = parts; - + hbox = gtk_hbox_new(FALSE, 3); - + add = gtk_button_new_with_mnemonic (_("Add Ac_tion")); gtk_button_set_image (GTK_BUTTON (add), gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON)); /* gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE); */ g_signal_connect(add, "clicked", G_CALLBACK(more_parts), data); gtk_box_pack_start(GTK_BOX(hbox), add, FALSE, FALSE, 0); - + gtk_box_pack_start(GTK_BOX(inframe), hbox, FALSE, FALSE, 3); - + l = ff->actions; while (l) { part = l->data; @@ -530,20 +530,20 @@ get_widget(FilterRule *fr, RuleContext *rc) attach_rule(w, data, part, i++); l = l->next; } - + hadj = gtk_adjustment_new(0.0, 0.0, 1.0, 1.0 ,1.0, 1.0); vadj = gtk_adjustment_new(0.0, 0.0, 1.0, 1.0 ,1.0, 1.0); scrolledwindow = gtk_scrolled_window_new(GTK_ADJUSTMENT(hadj), GTK_ADJUSTMENT(vadj)); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), parts); - + gtk_box_pack_start(GTK_BOX(inframe), scrolledwindow, TRUE, TRUE, 0); - + /*gtk_box_pack_start(GTK_BOX(inframe), parts, FALSE, FALSE, 3);*/ - + gtk_widget_show_all(widget); - + return widget; } diff --git a/mail/em-filter-rule.h b/mail/em-filter-rule.h index 75c4b2834a..93953cd56b 100644 --- a/mail/em-filter-rule.h +++ b/mail/em-filter-rule.h @@ -36,7 +36,7 @@ typedef struct _EMFilterRuleClass EMFilterRuleClass; struct _EMFilterRule { FilterRule parent_object; - + GList *actions; }; diff --git a/mail/em-filter-source-element.c b/mail/em-filter-source-element.c index 2d6c551e2a..316e7f8435 100644 --- a/mail/em-filter-source-element.c +++ b/mail/em-filter-source-element.c @@ -73,7 +73,7 @@ GType em_filter_source_element_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMFilterSourceElementClass), @@ -86,10 +86,10 @@ em_filter_source_element_get_type(void) 0, /* n_preallocs */ (GInstanceInitFunc)em_filter_source_element_init, }; - + type = g_type_register_static(FILTER_TYPE_ELEMENT, "EMFilterSourceElement", &info, 0); } - + return type; } @@ -98,11 +98,11 @@ em_filter_source_element_class_init(EMFilterSourceElementClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); FilterElementClass *fe_class = FILTER_ELEMENT_CLASS(klass); - + parent_class = g_type_class_ref(FILTER_TYPE_ELEMENT); - + object_class->finalize = em_filter_source_element_finalize; - + /* override methods */ fe_class->eq = source_eq; fe_class->xml_create = xml_create; @@ -127,7 +127,7 @@ em_filter_source_element_finalize(GObject *obj) { EMFilterSourceElement *fs = (EMFilterSourceElement *)obj; GList *i = fs->priv->sources; - + while (i) { SourceInfo *info = i->data; g_free(info->account_name); @@ -137,12 +137,12 @@ em_filter_source_element_finalize(GObject *obj) g_free(info); i = g_list_next(i); } - + g_list_free(fs->priv->sources); g_free(fs->priv->current_url); g_free(fs->priv); - + G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -156,7 +156,7 @@ static int source_eq(FilterElement *fe, FilterElement *cm) { EMFilterSourceElement *fs = (EMFilterSourceElement *)fe, *cs = (EMFilterSourceElement *)cm; - + return FILTER_ELEMENT_CLASS(parent_class)->eq(fe, cm) &&((fs->priv->current_url && cs->priv->current_url && strcmp(fs->priv->current_url, cs->priv->current_url)== 0) @@ -174,16 +174,16 @@ static xmlNodePtr xml_encode(FilterElement *fe) { xmlNodePtr value; - + EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; - + value = xmlNewNode(NULL, (const unsigned char *)"value"); xmlSetProp(value, (const unsigned char *)"name", (unsigned char *)fe->name); xmlSetProp(value, (const unsigned char *)"type", (const unsigned char *)"uri"); - + if (fs->priv->current_url) xmlNewTextChild(value, NULL, (const unsigned char *)"uri", (unsigned char *)fs->priv->current_url); - + return value; } @@ -193,23 +193,23 @@ xml_decode(FilterElement *fe, xmlNodePtr node) EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; CamelURL *url; char *uri; - + node = node->children; while (node != NULL) { if (!strcmp((char *)node->name, "uri")) { uri = (char *)xmlNodeGetContent(node); url = camel_url_new(uri, NULL); xmlFree(uri); - + g_free(fs->priv->current_url); fs->priv->current_url = camel_url_to_string(url, CAMEL_URL_HIDE_ALL); camel_url_free(url); break; } - + node = node->next; } - + return 0; } @@ -219,16 +219,16 @@ clone(FilterElement *fe) EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; EMFilterSourceElement *cpy = em_filter_source_element_new(); GList *i; - + ((FilterElement *)cpy)->name = (char *)xmlStrdup((unsigned char *)fe->name); - + cpy->priv->current_url = g_strdup(fs->priv->current_url); - + for (i = fs->priv->sources; i != NULL; i = g_list_next(i)) { SourceInfo *info = (SourceInfo *)i->data; em_filter_source_element_add_source(cpy, info->account_name, info->name, info->address, info->url); } - + return (FilterElement *)cpy; } @@ -236,7 +236,7 @@ static void source_changed(GtkWidget *item, EMFilterSourceElement *fs) { SourceInfo *info = (SourceInfo *)g_object_get_data((GObject *)item, "source"); - + g_free(fs->priv->current_url); fs->priv->current_url = g_strdup(info->url); } @@ -251,60 +251,60 @@ get_widget(FilterElement *fe) GList *i; SourceInfo *first = NULL; int index, current_index; - + if (fs->priv->sources == NULL) em_filter_source_element_get_sources(fs); - + menu = gtk_menu_new(); - + index = 0; current_index = -1; - + for (i = fs->priv->sources; i != NULL; i = g_list_next(i)) { SourceInfo *info = (SourceInfo *)i->data; char *label; - + if (info->url != NULL) { if (first == NULL) first = info; - + if (info->account_name && strcmp(info->account_name, info->address)) label = g_strdup_printf("%s <%s>(%s)", info->name, info->address, info->account_name); else label = g_strdup_printf("%s <%s>", info->name, info->address); - + item = gtk_menu_item_new_with_label(label); g_free(label); - + g_object_set_data((GObject *)item, "source", info); g_signal_connect(item, "activate", G_CALLBACK(source_changed), fs); - + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); gtk_widget_show(item); - + if (fs->priv->current_url && !strcmp(info->url, fs->priv->current_url)) current_index = index; - + index++; } } - + omenu = gtk_option_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); - + if (current_index >= 0) { gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), current_index); } else { gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), 0); g_free(fs->priv->current_url); - + if (first) fs->priv->current_url = g_strdup(first->url); else fs->priv->current_url = NULL; } - + return omenu; } @@ -318,7 +318,7 @@ static void format_sexp(FilterElement *fe, GString *out) { EMFilterSourceElement *fs = (EMFilterSourceElement *)fe; - + e_sexp_encode_string(out, fs->priv->current_url); } @@ -328,15 +328,15 @@ em_filter_source_element_add_source(EMFilterSourceElement *fs, const char *accou const char *addr, const char *url) { SourceInfo *info; - + g_return_if_fail(EM_IS_FILTER_SOURCE_ELEMENT(fs)); - + info = g_new0(SourceInfo, 1); info->account_name = g_strdup(account_name); info->name = g_strdup(name); info->address = g_strdup(addr); info->url = g_strdup(url); - + fs->priv->sources = g_list_append(fs->priv->sources, info); } @@ -349,12 +349,12 @@ em_filter_source_element_get_sources(EMFilterSourceElement *fs) EIterator *it; char *uri; CamelURL *url; - + /* should this get the global object from mail? */ gconf = gconf_client_get_default(); accounts = e_account_list_new(gconf); g_object_unref(gconf); - + for (it = e_list_get_iterator((EList *)accounts); e_iterator_is_valid(it); e_iterator_next(it)) { diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 28fb4ae19a..9bbb62e30f 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -115,16 +115,16 @@ struct _EMFolderBrowserPrivate { double default_scroll_position; guint idle_scroll_id; guint list_scrolled_id; - + guint vpane_resize_id; guint list_built_id; /* hook onto list-built for delayed 'select first unread' stuff */ - + char *select_uid; guint folder_changed_id; guint show_wide:1; gboolean scope_restricted; - + EMMenu *menu; /* toplevel menu manager */ }; @@ -241,7 +241,7 @@ emfb_pane_realised(GtkWidget *w, EMFolderBrowser *emfb) GConfClient *gconf; gconf = mail_config_get_gconf_client (); - + if (emfb->priv->show_wide) gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int(gconf, "/apps/evolution/mail/display/hpaned_size", NULL)); else @@ -260,9 +260,9 @@ emfb_pane_button_release_event(GtkWidget *w, GdkEventButton *e, EMFolderBrowser else gconf_client_set_int(gconf, "/apps/evolution/mail/display/paned_size", gtk_paned_get_position(GTK_PANED(w)), NULL); - + } - + return FALSE; } @@ -288,7 +288,7 @@ generate_viewoption_menu (GtkWidget *emfv) str = e_str_without_underscores (_(emfb_view_items[i].search.text)); menu_item = gtk_image_menu_item_new_with_label (str); if (emfb_view_items[i].image) - gtk_image_menu_item_set_image ((GtkImageMenuItem *)menu_item, e_icon_factory_get_image (emfb_view_items[i].image, E_ICON_SIZE_MENU)); + gtk_image_menu_item_set_image ((GtkImageMenuItem *)menu_item, e_icon_factory_get_image (emfb_view_items[i].image, E_ICON_SIZE_MENU)); g_free (str); } else { menu_item = gtk_menu_item_new (); @@ -311,24 +311,24 @@ generate_viewoption_menu (GtkWidget *emfv) GdkColor colour; GdkGC *gc; GtkWidget *image; - + gdk_color_parse(label->colour, &colour); gdk_colormap_alloc_color(gdk_colormap_get_system(), &colour, FALSE, TRUE); - + pixmap = gdk_pixmap_new(((GtkWidget *)emfv)->window, 16, 16, -1); gc = gdk_gc_new(((GtkWidget *)emfv)->window); gdk_gc_set_foreground(gc, &colour); gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, 16, 16); - g_object_unref(gc); - - image = gtk_image_new_from_pixmap(pixmap, NULL); + g_object_unref(gc); + + image = gtk_image_new_from_pixmap(pixmap, NULL); str = e_str_without_underscores (label->name); menu_item = gtk_image_menu_item_new_with_label (str); g_free (str); - gtk_image_menu_item_set_image ((GtkImageMenuItem *)menu_item, image); + gtk_image_menu_item_set_image ((GtkImageMenuItem *)menu_item, image); g_object_set_data (G_OBJECT (menu_item), "EsbItemId", GINT_TO_POINTER (VIEW_LABEL)); - + g_object_set_data (G_OBJECT (menu_item), "LabelTag", g_strdup(label->tag)); } @@ -343,7 +343,7 @@ generate_viewoption_menu (GtkWidget *emfv) str = e_str_without_underscores (_(temp_view_items[i].search.text)); menu_item = gtk_image_menu_item_new_with_label (str); if (temp_view_items[i].image) - gtk_image_menu_item_set_image ((GtkImageMenuItem *)menu_item, e_icon_factory_get_image (temp_view_items[i].image, E_ICON_SIZE_MENU)); + gtk_image_menu_item_set_image ((GtkImageMenuItem *)menu_item, e_icon_factory_get_image (temp_view_items[i].image, E_ICON_SIZE_MENU)); g_free (str); } else { menu_item = gtk_menu_item_new (); @@ -369,13 +369,13 @@ viewoption_menu_generator () ESearchBarItem dup_item; GSList *l; - for (i = 0; emfb_view_items[i].search.id != -1; i++) + for (i = 0; emfb_view_items[i].search.id != -1; i++) g_array_append_vals (menu, &emfb_view_items[i], 1); for (l = mail_config_get_labels(); l; l = l->next) { ESearchBarItem item; MailConfigLabel *label = l->data; - + item.text = label->name; item.id = VIEW_LABEL; @@ -397,9 +397,9 @@ emfb_realize (GtkWidget *widget) EMFolderBrowser *emfb = (EMFolderBrowser *)widget; menu = generate_viewoption_menu(widget); - e_search_bar_set_viewoption_menu ((ESearchBar *)emfb->search, menu); + e_search_bar_set_viewoption_menu ((ESearchBar *)emfb->search, menu); } - + static void html_scroll (GtkHTML *html, GtkOrientation orientation, @@ -413,10 +413,10 @@ html_scroll (GtkHTML *html, if (scroll_type == GTK_SCROLL_PAGE_FORWARD) { gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); - message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); + message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); } else if (scroll_type == GTK_SCROLL_PAGE_BACKWARD) { gtk_widget_grab_focus ((GtkWidget *)((EMFolderView *) emfb)->list); - message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); + message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); } } static void @@ -455,11 +455,11 @@ emfb_init(GObject *o) const char *systemrules = g_object_get_data (G_OBJECT (search_context), "system"); const char *userrules = g_object_get_data (G_OBJECT (search_context), "user"); EFilterBar *efb; - + emfb->search = e_filter_bar_new(search_context, systemrules, userrules, emfb_search_config_search, emfb); efb = (EFilterBar *)emfb->search; efb->account_search_vf = NULL; - efb->all_account_search_vf = NULL; + efb->all_account_search_vf = NULL; e_search_bar_set_menu ((ESearchBar *)emfb->search, emfb_search_items); e_search_bar_set_scopeoption ((ESearchBar *)emfb->search, emfb_search_scope_items); e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); @@ -470,7 +470,7 @@ emfb_init(GObject *o) p->search_menu_activated_id = g_signal_connect(emfb->search, "menu_activated", G_CALLBACK(emfb_search_menu_activated), emfb); p->search_activated_id = g_signal_connect(emfb->search, "search_activated", G_CALLBACK(emfb_search_search_activated), emfb); g_signal_connect(emfb->search, "search_cleared", G_CALLBACK(emfb_search_search_cleared), NULL); - + gtk_box_pack_start((GtkBox *)emfb, (GtkWidget *)emfb->search, FALSE, TRUE, 0); } @@ -483,7 +483,7 @@ emfb_init(GObject *o) gtk_widget_show(emfb->vpane); gtk_box_pack_start_defaults((GtkBox *)emfb, emfb->vpane); - + gtk_paned_add1((GtkPaned *)emfb->vpane, (GtkWidget *)emfb->view.list); gtk_widget_show((GtkWidget *)emfb->view.list); @@ -510,7 +510,7 @@ static void emfb_finalise(GObject *o) { EMFolderBrowser *emfb = (EMFolderBrowser *)o; - + g_free (emfb->priv->select_uid); g_free (emfb->priv); @@ -526,12 +526,12 @@ emfb_destroy(GtkObject *o) g_signal_handler_disconnect(((EMFolderView *)emfb)->list, emfb->priv->list_built_id); emfb->priv->list_built_id = 0; } - + if (emfb->priv->list_scrolled_id) { g_signal_handler_disconnect (((EMFolderView *) emfb)->list, emfb->priv->list_scrolled_id); emfb->priv->list_scrolled_id = 0; } - + if (emfb->priv->idle_scroll_id) { g_source_remove (emfb->priv->idle_scroll_id); emfb->priv->idle_scroll_id = 0; @@ -539,7 +539,7 @@ emfb_destroy(GtkObject *o) if (emfb->view.folder && emfb->priv->folder_changed_id) camel_object_remove_event(emfb->view.folder, emfb->priv->folder_changed_id); - + ((GtkObjectClass *)emfb_parent)->destroy(o); } @@ -604,7 +604,7 @@ GtkWidget *em_folder_browser_new(void) * @Class: org.gnome.evolution.mail.bonobomenu:1.0 * @Target: EMMenuTargetSelect * - * The main menu of mail view of the main application window. + * The main menu of mail view of the main application window. * If the folder is NULL (not selected), the target will be empty, not NULL. */ ((EMFolderView *)emfb)->menu = em_menu_new("org.gnome.evolution.mail.browser"); @@ -620,12 +620,12 @@ void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); emfb->priv->scope_restricted = FALSE; } - + return; } - + emfb->view.preview_active = state; - + if (state) { GConfClient *gconf = mail_config_get_gconf_client (); int paned_size /*, y*/; @@ -639,8 +639,8 @@ void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) if (emfb->view.list->cursor_uid) { char *uid = g_alloca(strlen(emfb->view.list->cursor_uid)+1); - e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); - emfb->priv->scope_restricted = FALSE; + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); + emfb->priv->scope_restricted = FALSE; strcpy(uid, emfb->view.list->cursor_uid); em_folder_view_set_message(&emfb->view, uid, FALSE); } @@ -655,7 +655,7 @@ void em_folder_browser_show_preview(EMFolderBrowser *emfb, gboolean state) emfb->view.displayed_uid = NULL; gtk_widget_hide(emfb->priv->preview); - e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); emfb->priv->scope_restricted = TRUE; /* mail_display_set_message (emfb->mail_display, NULL, NULL, NULL); @@ -713,22 +713,22 @@ static void emfb_search_menu_activated(ESearchBar *esb, int id, EMFolderBrowser *emfb) { EFilterBar *efb = (EFilterBar *)esb; - + d(printf("menu activated\n")); - + switch (id) { case ESB_SAVE: d(printf("Save vfolder\n")); if (efb->current_query) { - FilterRule *rule = vfolder_clone_rule(efb->current_query); + FilterRule *rule = vfolder_clone_rule(efb->current_query); char *name, *text; - + text = e_search_bar_get_text(esb); name = g_strdup_printf("%s %s", rule->name, (text&&text[0])?text:"''"); g_free (text); filter_rule_set_name(rule, name); g_free (name); - + filter_rule_set_source(rule, FILTER_SOURCE_INCOMING); em_vfolder_rule_add_source((EMVFolderRule *)rule, emfb->view.folder_uri); vfolder_gui_add_rule((EMVFolderRule *)rule); @@ -750,7 +750,7 @@ emfb_search_config_search(EFilterBar *efb, FilterRule *rule, int id, const char partl = rule->parts; while (partl) { FilterPart *part = partl->data; - + if (!strcmp(part->name, "subject")) { FilterInput *input = (FilterInput *)filter_part_find_element(part, "subject"); if (input) @@ -759,7 +759,7 @@ emfb_search_config_search(EFilterBar *efb, FilterRule *rule, int id, const char FilterInput *input = (FilterInput *)filter_part_find_element(part, "word"); if (input) filter_input_set_value(input, query); - + words = camel_search_words_split((unsigned char *)query); for (i=0;i<words->len;i++) strings = g_slist_prepend(strings, g_strdup(words->words[i]->word)); @@ -773,7 +773,7 @@ emfb_search_config_search(EFilterBar *efb, FilterRule *rule, int id, const char if (input) filter_input_set_value(input, query); } - + partl = partl->next; } @@ -826,7 +826,7 @@ get_view_query (ESearchBar *esb) case VIEW_NO_LABEL: /* FIXME : cannot hard code this query */ view_sexp = "(and (match-all (not (= (user-tag \"label\") \"important\")))" - "(match-all (not (= (user-tag \"label\") \"work\"))) (match-all (not (= (user-tag \"label\") \"personal\")))" + "(match-all (not (= (user-tag \"label\") \"work\"))) (match-all (not (= (user-tag \"label\") \"personal\")))" "(match-all (not (= (user-tag \"label\") \"todo\"))) (match-all (not (= (user-tag \"label\") \"later\"))) ))"; break; case VIEW_LABEL: @@ -949,14 +949,14 @@ vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList { struct _setup_msg *m; int id; - + m = mail_msg_new(&vfolder_setup_op, NULL, sizeof (*m)); m->folder = folder; camel_object_ref(folder); m->query = g_strdup(query); m->sources_uri = sources_uri; m->sources_folder = sources_folder; - + id = m->msg.seq; e_thread_put(mail_thread_queued_slow, (EMsg *)m); @@ -981,7 +981,7 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) if (emfv->list == NULL || emfv->folder == NULL) return; - + id = e_search_bar_get_search_scope (esb); switch (id) { @@ -1013,11 +1013,11 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) break; } - g_object_get (esb, "query", &search_word, NULL); + g_object_get (esb, "query", &search_word, NULL); if (efb->account_search_vf && !strcmp (search_word, ((CamelVeeFolder *) efb->account_search_vf)->expression) ) { break; } - gtk_widget_set_sensitive (esb->scopeoption, FALSE); + gtk_widget_set_sensitive (esb->scopeoption, FALSE); /* Disable the folder tree */ g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_ACTIVATED], 0); @@ -1044,12 +1044,12 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) folder_uri = mail_tools_folder_to_url ((CamelFolder *)efb->account_search_vf); emfb_set_search_folder (emfv, (CamelFolder *)efb->account_search_vf, folder_uri); g_free (folder_uri); - g_free (storeuri); + g_free (storeuri); } else { /* Reuse the existing search folder */ camel_vee_folder_set_expression((CamelVeeFolder *)efb->account_search_vf, search_word); } - + break; case E_FILTERBAR_ALL_ACCOUNTS_ID: @@ -1061,18 +1061,18 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) efb->all_account_search_vf=NULL; } g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_CLEARED], 0); - gtk_widget_set_sensitive (esb->scopeoption, TRUE); + gtk_widget_set_sensitive (esb->scopeoption, TRUE); break; } g_object_get (esb, "query", &search_word, NULL); - + if (search_word && efb->all_account_search_vf && !strcmp (search_word, ((CamelVeeFolder *) efb->all_account_search_vf)->expression) ) { /* No real search apart from the existing one */ break; } - - gtk_widget_set_sensitive (esb->scopeoption, FALSE); + + gtk_widget_set_sensitive (esb->scopeoption, FALSE); g_signal_emit (emfb, folder_browser_signals [ACCOUNT_SEARCH_ACTIVATED], 0); if (!efb->all_account_search_vf) { @@ -1121,13 +1121,13 @@ emfb_search_search_activated(ESearchBar *esb, EMFolderBrowser *emfb) /* Reuse the existing search folder */ camel_vee_folder_set_expression((CamelVeeFolder *)efb->all_account_search_vf, search_word); } - + break; } g_object_get (esb, "state", &search_state, NULL); camel_object_meta_set (emfv->folder, "evolution:search_state", search_state); camel_object_state_write (emfv->folder); - + /* Merge the view and search expresion*/ view_sexp = get_view_query (esb); g_object_get (esb, "query", &search_word, NULL); @@ -1159,7 +1159,7 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, gboolean state, folder_choose = TRUE; if ((ev->key.state & GDK_CONTROL_MASK) != 0) return FALSE; - + switch (ev->key.keyval) { case GDK_space: if (!emfb->view.preview->caret_mode) { @@ -1167,11 +1167,11 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, if (!state) { folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); if (!folder_choose) - folder_choose = message_list_select(((EMFolderView *) emfb)->list, + folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_NEXT | MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN); } - } else + } else em_utils_adjustment_page(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow *)emfb->priv->scroll), TRUE); break; case GDK_BackSpace: @@ -1180,7 +1180,7 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, if (!state) { folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_PREVIOUS, 0, CAMEL_MESSAGE_SEEN); if (!folder_choose) - folder_choose = message_list_select(((EMFolderView *) emfb)->list, + folder_choose = message_list_select(((EMFolderView *) emfb)->list, MESSAGE_LIST_SELECT_PREVIOUS | MESSAGE_LIST_SELECT_WRAP, 0, CAMEL_MESSAGE_SEEN); } @@ -1190,7 +1190,7 @@ emfb_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, default: return FALSE; } - + if (!folder_choose && !emfb->view.preview->caret_mode) { //check for unread messages. if yes .. rewindback to the folder EMFolderTree *emft = g_object_get_data((GObject*)emfb, "foldertree"); @@ -1216,10 +1216,10 @@ emfb_list_message_selected (MessageList *ml, const char *uid, EMFolderBrowser *e return; if (uid && *uid && emfb->priv->scope_restricted && emfb->view.preview_active) { - e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, TRUE); emfb->priv->scope_restricted = FALSE; } else if ( !(uid && *uid) && !emfb->priv->scope_restricted) { - e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); + e_search_bar_scope_enable ((ESearchBar *)emfb->search, E_FILTERBAR_CURRENT_MESSAGE_ID, FALSE); emfb->priv->scope_restricted = TRUE; } @@ -1272,7 +1272,7 @@ static void emfb_edit_invert_selection(BonoboUIComponent *uid, void *data, const char *path) { EMFolderView *emfv = data; - + message_list_invert_selection(emfv->list); } @@ -1280,7 +1280,7 @@ static void emfb_edit_select_all(BonoboUIComponent *uid, void *data, const char *path) { EMFolderView *emfv = data; - + message_list_select_all(emfv->list); gtk_widget_grab_focus ((GtkWidget *)emfv->list); } @@ -1289,7 +1289,7 @@ static void emfb_edit_select_thread(BonoboUIComponent *uid, void *data, const char *path) { EMFolderView *emfv = data; - + message_list_select_thread(emfv->list); } @@ -1411,7 +1411,7 @@ emfb_folder_create(BonoboUIComponent *uid, void *data, const char *path) if ((fi = em_folder_tree_get_selected_folder_info (tree)) != NULL) { em_folder_utils_create_folder(fi, tree); camel_folder_info_free(fi); - } + } } else { em_folder_utils_create_folder(NULL, tree); } @@ -1452,7 +1452,7 @@ static void emfb_view_hide_read(BonoboUIComponent *uid, void *data, const char *path) { EMFolderView *emfv = data; - + message_list_hide_add(emfv->list, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME); } @@ -1501,7 +1501,7 @@ static void emfb_tools_filters(BonoboUIComponent *uid, void *data, const char *path) { EMFolderBrowser *emfb = data; - + em_utils_edit_filters ((GtkWidget *) emfb); } @@ -1559,7 +1559,7 @@ static BonoboUIVerb emfb_verbs[] = { /* ViewThreaded is a toggle */ BONOBO_UI_UNSAFE_VERB ("ViewThreadsExpandAll", emfb_expand_all_threads), - BONOBO_UI_UNSAFE_VERB ("ViewThreadsCollapseAll", emfb_collapse_all_threads), + BONOBO_UI_UNSAFE_VERB ("ViewThreadsCollapseAll", emfb_collapse_all_threads), BONOBO_UI_UNSAFE_VERB ("FolderCopy", emfb_folder_copy), BONOBO_UI_UNSAFE_VERB ("FolderMove", emfb_folder_move), @@ -1574,7 +1574,7 @@ static BonoboUIVerb emfb_verbs[] = { BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", emfb_tools_subscriptions), BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", emfb_tools_vfolders), BONOBO_UI_UNSAFE_VERB ("FocusSearch", emfb_focus_search), - + /* ViewPreview is a toggle */ BONOBO_UI_VERB_END @@ -1620,7 +1620,7 @@ emfb_view_threaded(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_ /* FIXME: do set_threaded via meta-data listener on folder? */ message_list_set_threaded(emfv->list, state[0] != '0'); - + /* FIXME: update selection state? */ } @@ -1679,13 +1679,13 @@ emfb_list_scrolled (MessageList *ml, EMFolderBrowser *emfb) EMFolderView *emfv = (EMFolderView *) emfb; double position; char *state; - + position = message_list_get_scrollbar_position (ml); state = g_strdup_printf ("%f", position); - + if (camel_object_meta_set (emfv->folder, "evolution:list_scroll_position", state)) camel_object_state_write (emfv->folder); - + g_free (state); } @@ -1695,20 +1695,20 @@ scroll_idle_cb (EMFolderBrowser *emfb) EMFolderView *emfv = (EMFolderView *) emfb; double position; char *state; - + if ((state = camel_object_meta_get (emfv->folder, "evolution:list_scroll_position"))) { position = strtod (state, NULL); g_free (state); } else { position = emfb->priv->default_scroll_position; } - + message_list_set_scrollbar_position (emfv->list, position); - + emfb->priv->list_scrolled_id = g_signal_connect (emfv->list, "message_list_scrolled", G_CALLBACK (emfb_list_scrolled), emfb); - + emfb->priv->idle_scroll_id = 0; - + return FALSE; } @@ -1754,10 +1754,10 @@ emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) { EMFolderView *emfv = (EMFolderView *) emfb; double position = 0.0f; - + g_signal_handler_disconnect (ml, emfb->priv->list_built_id); emfb->priv->list_built_id = 0; - + if (emfv->list->cursor_uid == NULL) { if (emfb->priv->select_uid) { CamelMessageInfo *mi; @@ -1771,7 +1771,7 @@ emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) g_free (emfb->priv->select_uid); emfb->priv->select_uid = NULL; } - + /* change the default to the current position */ position = message_list_get_scrollbar_position (ml); } else { @@ -1780,9 +1780,9 @@ emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) /*message_list_select (ml, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE);*/ } } - + emfb->priv->default_scroll_position = position; - + /* FIXME: this is a gross workaround for an etable bug that I can't fix - bug #55303 */ /* this needs to be a lower priority than anything in e-table-item/e-canvas, since * e_canvas_item_region_show_relay() uses a timeout, we have to use a timeout of the @@ -1797,14 +1797,14 @@ emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) { EMFolderBrowser *emfb = (EMFolderBrowser *) emfv; char *state; - + message_list_freeze(emfv->list); - + if (emfb->priv->list_scrolled_id) { g_signal_handler_disconnect (emfv->list, emfb->priv->list_scrolled_id); emfb->priv->list_scrolled_id = 0; } - + if (emfb->priv->idle_scroll_id) { g_source_remove (emfb->priv->idle_scroll_id); emfb->priv->idle_scroll_id = 0; @@ -1824,7 +1824,7 @@ emfb_set_search_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) "<column source=\"7\"/> <column source=\"13\"/> " "<grouping><leaf column=\"7\" ascending=\"false\"/> </grouping> </ETableState>"; e_tree_set_state (((MessageList *)emfv->list)->tree, state); - + message_list_thaw(emfv->list); } @@ -1834,14 +1834,14 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) { EMFolderBrowser *emfb = (EMFolderBrowser *) emfv; struct _EMFolderBrowserPrivate *p = emfb->priv; - + message_list_freeze(emfv->list); - + if (emfb->priv->list_scrolled_id) { g_signal_handler_disconnect (emfv->list, emfb->priv->list_scrolled_id); emfb->priv->list_scrolled_id = 0; } - + if (emfb->priv->idle_scroll_id) { g_source_remove (emfb->priv->idle_scroll_id); emfb->priv->idle_scroll_id = 0; @@ -1853,7 +1853,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) } emfb_parent->set_folder(emfv, folder, uri); - + /* This is required since we get activated the first time before the folder is open and need to override the defaults */ @@ -1862,7 +1862,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) int state; gboolean safe; GConfClient *gconf = mail_config_get_gconf_client(); - + safe = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/safe_list", NULL); if (safe) { if (camel_object_meta_set(emfv->folder, "evolution:show_preview", "0") && @@ -1886,7 +1886,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) em_folder_browser_show_preview(emfb, state); if (emfv->uic) bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewPreview", "state", state?"1":"0", NULL); - + if ((sstate = camel_object_meta_get(folder, "evolution:thread_list"))) { state = sstate[0] != '0'; g_free(sstate); @@ -1895,10 +1895,10 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) message_list_set_threaded(emfv->list, state); if (emfv->uic) { bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL); - bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL); - bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL); + bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL); + bonobo_ui_component_set_prop(emfv->uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL); } - + if (emfv->uic) { state = (folder->folder_flags & CAMEL_FOLDER_IS_TRASH) == 0; bonobo_ui_component_set_prop(emfv->uic, "/commands/HideDeleted", "sensitive", state?"1":"0", NULL); @@ -1908,7 +1908,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) sstate = camel_object_meta_get(folder, "evolution:search_state"); g_object_set(emfb->search, "state", sstate, NULL); g_free(sstate); - + /* set the query manually, so we dont pop up advanced or saved search stuff */ if ((sstate = camel_object_meta_get (folder, "evolution:selected_uid"))) { @@ -1917,7 +1917,7 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) g_free(p->select_uid); p->select_uid = NULL; } - + if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0) p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv); } @@ -1949,7 +1949,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) g_signal_handler_block(emfb->vpane, emfb->priv->vpane_resize_id); gtk_paned_set_position((GtkPaned *)emfb->vpane, gconf_client_get_int (gconf, emfb->priv->show_wide ? "/apps/evolution/mail/display/hpaned_size": "/apps/evolution/mail/display/paned_size", NULL)); g_signal_handler_unblock(emfb->vpane, emfb->priv->vpane_resize_id); - + /* (Pre)view toggle */ if (emfv->folder && (sstate = camel_object_meta_get(emfv->folder, "evolution:show_preview"))) { @@ -1962,7 +1962,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) bonobo_ui_component_set_prop(uic, "/commands/ViewPreview", "state", state?"1":"0", NULL); em_folder_browser_show_preview((EMFolderBrowser *)emfv, state); bonobo_ui_component_add_listener(uic, "ViewPreview", emfb_view_preview, emfv); - + /* Stop button */ state = mail_msg_active((unsigned int)-1); bonobo_ui_component_set_prop(uic, "/commands/MailStop", "sensitive", state?"1":"0", NULL); @@ -1991,8 +1991,8 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) } bonobo_ui_component_set_prop(uic, "/commands/ViewThreaded", "state", state?"1":"0", NULL); - bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL); - bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL); + bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsCollapseAll", "sensitive", state?"1":"0", NULL); + bonobo_ui_component_set_prop(uic, "/commands/ViewThreadsExpandAll", "sensitive", state?"1":"0", NULL); bonobo_ui_component_add_listener(uic, "ViewThreaded", emfb_view_threaded, emfv); message_list_set_threaded(emfv->list, state); @@ -2002,9 +2002,9 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) bonobo_ui_component_set_prop(uic, "/commands/ViewBelow", "state", "0", NULL); } else { bonobo_ui_component_set_prop(uic, "/commands/ViewAfter", "state", "0", NULL); - bonobo_ui_component_set_prop(uic, "/commands/ViewBelow", "state", "1", NULL); + bonobo_ui_component_set_prop(uic, "/commands/ViewBelow", "state", "1", NULL); } - + bonobo_ui_component_add_listener(uic, "ViewAfter", emfb_show_next, emfv); bonobo_ui_component_add_listener(uic, "ViewBelow", emfb_show_below, emfv); /* em_folder_browser_show_wide((EMFolderBrowser *)emfv, state); */ @@ -2018,7 +2018,7 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) e_search_bar_set_ui_component((ESearchBar *)((EMFolderBrowser *)emfv)->search, uic); } else { const BonoboUIVerb *v; - + for (v = &emfb_verbs[0]; v->cname; v++) bonobo_ui_component_remove_verb(uic, v->cname); diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c index 697641f7cd..98adb08588 100644 --- a/mail/em-folder-properties.c +++ b/mail/em-folder-properties.c @@ -84,10 +84,10 @@ emfp_commit(EConfig *ec, GSList *items, void *data) struct _prop_data *prop_data = data; CamelArgV *argv = prop_data->argv; int i; - + for (i = 0; i < argv->argc; i++) { CamelArg *arg = &argv->argv[i]; - + switch (arg->tag & CAMEL_ARG_TYPE) { case CAMEL_ARG_BOO: arg->ca_int = gtk_toggle_button_get_active ((GtkToggleButton *) prop_data->widgets[i]); @@ -101,7 +101,7 @@ emfp_commit(EConfig *ec, GSList *items, void *data) break; } } - + camel_object_setv (prop_data->object, NULL, argv); } @@ -110,7 +110,7 @@ emfp_free(EConfig *ec, GSList *items, void *data) { struct _prop_data *prop_data = data; int i; - + g_slist_free(items); for (i = 0; i < prop_data->argv->argc; i++) { @@ -120,7 +120,7 @@ emfp_free(EConfig *ec, GSList *items, void *data) camel_object_free (prop_data->object, CAMEL_FOLDER_PROPERTIES, prop_data->properties); camel_object_free (prop_data->object, CAMEL_FOLDER_NAME, prop_data->name); - + camel_object_unref (prop_data->object); g_free (prop_data->argv); @@ -150,7 +150,7 @@ emfp_get_folder_item(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, gtk_widget_show (label); gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5); gtk_table_attach ((GtkTable *) table, label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - + sprintf(countstr, "%d", prop_data->unread); label = gtk_label_new (countstr); gtk_widget_show (label); @@ -164,7 +164,7 @@ emfp_get_folder_item(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, gtk_widget_show (label); gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5); gtk_table_attach ((GtkTable *) table, label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - + sprintf(countstr, "%d", prop_data->total); label = gtk_label_new (countstr); gtk_widget_show (label); @@ -177,7 +177,7 @@ emfp_get_folder_item(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, i = 0; while (l) { CamelProperty *prop = l->data; - + switch (prop->tag & CAMEL_ARG_TYPE) { case CAMEL_ARG_BOO: w = gtk_check_button_new_with_label (prop->description); @@ -191,7 +191,7 @@ emfp_get_folder_item(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, gtk_misc_set_alignment ((GtkMisc *) label, 0.0, 0.5); gtk_widget_show (label); gtk_table_attach ((GtkTable *) table, label, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - + w = gtk_entry_new (); gtk_widget_show (w); if (prop_data->argv->argv[i].ca_str) { @@ -206,7 +206,7 @@ emfp_get_folder_item(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, g_warning ("This shouldn't be reached\n"); break; } - + row++; l = l->next; i++; @@ -250,16 +250,16 @@ emfp_dialog_got_folder (char *uri, CamelFolder *folder, void *data) camel_object_ref (folder); /* - Get number of VISIBLE and DELETED messages, instead of TOTAL messages. VISIBLE+DELETED + Get number of VISIBLE and DELETED messages, instead of TOTAL messages. VISIBLE+DELETED gives the correct count that matches the label below the Send & Receive button */ camel_object_get (folder, NULL, CAMEL_FOLDER_PROPERTIES, &prop_data->properties, CAMEL_FOLDER_NAME, &prop_data->name, CAMEL_FOLDER_VISIBLE, &prop_data->total, CAMEL_FOLDER_UNREAD, &prop_data->unread, CAMEL_FOLDER_DELETED, &deleted, NULL); - + gconf = mail_config_get_gconf_client (); hide_deleted = !gconf_client_get_bool(gconf, "/apps/evolution/mail/display/show_deleted", NULL); - /* + /* Do the calculation only for those accounts that support VTRASHes */ if (store->flags & CAMEL_STORE_VTRASH) { @@ -302,20 +302,20 @@ emfp_dialog_got_folder (char *uri, CamelFolder *folder, void *data) argv->argc = count; arggetv = g_malloc0 (sizeof (*arggetv) + (count - CAMEL_ARGV_MAX) * sizeof (arggetv->argv[0])); arggetv->argc = count; - + i = 0; l = prop_data->properties; while (l) { CamelProperty *prop = l->data; - + argv->argv[i].tag = prop->tag; arggetv->argv[i].tag = prop->tag; arggetv->argv[i].ca_ptr = &argv->argv[i].ca_ptr; - + l = l->next; i++; } - + camel_object_getv (prop_data->object, NULL, arggetv); g_free (arggetv); prop_data->argv = argv; @@ -351,7 +351,7 @@ emfp_dialog_got_folder (char *uri, CamelFolder *folder, void *data) gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, w, TRUE, TRUE, 0); /* we do 'apply on ok' ... since instant apply may apply some very long running tasks */ - + g_signal_connect (dialog, "response", G_CALLBACK (emfp_dialog_response), prop_data); gtk_widget_show (dialog); } @@ -359,9 +359,9 @@ emfp_dialog_got_folder (char *uri, CamelFolder *folder, void *data) /** * em_folder_properties_show: * @parent: parent window for dialogue (currently unused) - * @folder: - * @uri: - * + * @folder: + * @uri: + * * Show folder properties for @folder and @uri. If @folder is passed * as NULL, then the folder @uri will be loaded first. **/ diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c index 0cb4b437d6..1a6406943f 100644 --- a/mail/em-folder-selection-button.c +++ b/mail/em-folder-selection-button.c @@ -53,13 +53,13 @@ struct _EMFolderSelectionButtonPrivate { GtkWidget *label; GtkWidget *selector; - + char *uri; /* for single-select mode */ GList *uris; /* for multi-select mode */ - + char *title; char *caption; - + gboolean multiple_select; }; @@ -74,7 +74,7 @@ GType em_folder_selection_button_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMFolderSelectionButtonClass), @@ -87,10 +87,10 @@ em_folder_selection_button_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) em_folder_selection_button_init, }; - + type = g_type_register_static (GTK_TYPE_BUTTON, "EMFolderSelectionButton", &info, 0); } - + return type; } @@ -100,13 +100,13 @@ em_folder_selection_button_class_init (EMFolderSelectionButtonClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass); - + parent_class = g_type_class_ref (GTK_TYPE_BUTTON); - + object_class->finalize = em_folder_selection_button_finalize; gtk_object_class->destroy = em_folder_selection_button_destroy; button_class->clicked = em_folder_selection_button_clicked; - + signals[SELECTED] = g_signal_new ("selected", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST, @@ -118,7 +118,7 @@ em_folder_selection_button_class_init (EMFolderSelectionButtonClass *klass) static void set_contents_unselected (EMFolderSelectionButton *button) -{ +{ gtk_image_set_from_pixbuf (GTK_IMAGE (button->priv->icon), NULL); gtk_label_set_text (GTK_LABEL (button->priv->label), _("<click here to select a folder>")); } @@ -128,7 +128,7 @@ set_contents (EMFolderSelectionButton *button) { struct _EMFolderSelectionButtonPrivate *priv = button->priv; char *folder_name = em_utils_folder_name_from_uri (priv->uri); - + if (folder_name) { gtk_label_set_text (GTK_LABEL (priv->label), _(folder_name)); g_free (folder_name); @@ -142,27 +142,27 @@ em_folder_selection_button_init (EMFolderSelectionButton *emfsb) { struct _EMFolderSelectionButtonPrivate *priv; GtkWidget *box; - + priv = g_new0 (struct _EMFolderSelectionButtonPrivate, 1); emfsb->priv = priv; - + priv->multiple_select = FALSE; - + box = gtk_hbox_new (FALSE, 4); - + priv->icon = gtk_image_new (); gtk_widget_show (priv->icon); gtk_box_pack_start (GTK_BOX (box), priv->icon, FALSE, TRUE, 0); - + priv->label = gtk_label_new (""); gtk_widget_show (priv->label); gtk_label_set_justify (GTK_LABEL (priv->label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.0); gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0); - + gtk_widget_show (box); gtk_container_add (GTK_CONTAINER (emfsb), box); - + set_contents (emfsb); } @@ -187,12 +187,12 @@ em_folder_selection_button_finalize (GObject *obj) GList *lst = ((EMFolderSelectionButton*) obj)->priv->uris; g_list_foreach (lst, (GFunc) g_free, NULL); g_list_free (lst); - + g_free (priv->title); g_free (priv->caption); g_free (priv->uri); g_free (priv); - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -202,17 +202,17 @@ emfsb_selector_response (EMFolderSelector *emfs, int response, EMFolderSelection if (response == GTK_RESPONSE_OK) { if (button->priv->multiple_select) { GList *uris = em_folder_selector_get_selected_uris (emfs); - + em_folder_selection_button_set_selection_mult (button, uris); g_signal_emit (button, signals[SELECTED], 0); } else { const char *uri = em_folder_selector_get_selected_uri (emfs); - + em_folder_selection_button_set_selection (button, uri); g_signal_emit (button, signals[SELECTED], 0); } } - + gtk_widget_destroy ((GtkWidget *) emfs); } @@ -223,7 +223,7 @@ em_folder_selection_button_clicked (GtkButton *button) EMFolderTreeModel *model; EMFolderTree *emft; GtkWidget *dialog; - + if (GTK_BUTTON_CLASS (parent_class)->clicked != NULL) (* GTK_BUTTON_CLASS (parent_class)->clicked) (button); @@ -252,10 +252,10 @@ GtkWidget * em_folder_selection_button_new (const char *title, const char *caption) { EMFolderSelectionButton *button = g_object_new (EM_TYPE_FOLDER_SELECTION_BUTTON, NULL); - + button->priv->title = g_strdup (title); button->priv->caption = g_strdup (caption); - + return GTK_WIDGET (button); } @@ -263,14 +263,14 @@ void em_folder_selection_button_set_selection (EMFolderSelectionButton *button, const char *uri) { struct _EMFolderSelectionButtonPrivate *priv = button->priv; - + g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button)); - + if (priv->uri != uri) { g_free (priv->uri); priv->uri = g_strdup (uri); } - + set_contents (button); } @@ -278,7 +278,7 @@ const char * em_folder_selection_button_get_selection (EMFolderSelectionButton *button) { g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL); - + return button->priv->uri; } @@ -287,20 +287,20 @@ em_folder_selection_button_set_selection_mult (EMFolderSelectionButton *button, { struct _EMFolderSelectionButtonPrivate *priv = button->priv; char *caption, *tmp, *tmp2; - + g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button)); - + if (priv->uris) { g_list_foreach (priv->uris, (GFunc) g_free, NULL); g_list_free (priv->uris); priv->uris = NULL; } - + priv->uris = uris; - + /* compile the name */ caption = g_strdup (""); - + while (uris) { tmp = em_utils_folder_name_from_uri (uris->data); if (tmp) { @@ -316,12 +316,12 @@ em_folder_selection_button_set_selection_mult (EMFolderSelectionButton *button, priv->uris = g_list_remove (priv->uris, uris->data); } } - + if (caption[0]) gtk_label_set_text (GTK_LABEL (priv->label), caption + 2); else set_contents_unselected (button); - + g_free (caption); } @@ -329,7 +329,7 @@ GList * em_folder_selection_button_get_selection_mult (EMFolderSelectionButton *button) { g_return_val_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button), NULL); - + return button->priv->uris; } diff --git a/mail/em-folder-selection-button.h b/mail/em-folder-selection-button.h index 172c97c28c..5077f86f2a 100644 --- a/mail/em-folder-selection-button.h +++ b/mail/em-folder-selection-button.h @@ -42,15 +42,15 @@ typedef struct _EMFolderSelectionButtonClass EMFolderSelectionButtonClass; struct _EMFolderSelectionButton { GtkButton parent; - + struct _EMFolderSelectionButtonPrivate *priv; }; struct _EMFolderSelectionButtonClass { GtkButtonClass parent_class; - + /* Signals. */ - + void (* selected) (EMFolderSelectionButton *button); }; diff --git a/mail/em-folder-selection.c b/mail/em-folder-selection.c index d5d4430545..fb8ce56f1d 100644 --- a/mail/em-folder-selection.c +++ b/mail/em-folder-selection.c @@ -62,23 +62,23 @@ em_select_folder (GtkWindow *parent_window, const char *title, const char *oklab EMFolderTreeModel *model; GtkWidget *dialog; EMFolderTree *emft; - + model = mail_component_peek_tree_model (mail_component_peek ()); emft = (EMFolderTree *) em_folder_tree_new_with_model (model); if (exclude) em_folder_tree_set_excluded_func(emft, exclude, user_data); else em_folder_tree_set_excluded (emft, EMFT_EXCLUDE_NOSELECT|EMFT_EXCLUDE_VIRTUAL|EMFT_EXCLUDE_VTRASH); - + dialog = em_folder_selector_new(emft, EM_FOLDER_SELECTOR_CAN_CREATE, title, NULL, oklabel); - + d = g_malloc0(sizeof(*d)); d->data = user_data; d->done = done; g_signal_connect(dialog, "response", G_CALLBACK (emfs_selector_response), d); g_object_set_data_full((GObject *)dialog, "e-select-data", d, (GDestroyNotify)g_free); gtk_widget_show(dialog); - + if (default_uri) em_folder_selector_set_selected((EMFolderSelector *)dialog, default_uri); } diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 3294c4fa5a..eb1cfa19bd 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -67,7 +67,7 @@ GType em_folder_selector_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMFolderSelectorClass), @@ -80,10 +80,10 @@ em_folder_selector_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) em_folder_selector_init, }; - + type = g_type_register_static (GTK_TYPE_DIALOG, "EMFolderSelector", &info, 0); } - + return type; } @@ -92,9 +92,9 @@ em_folder_selector_class_init (EMFolderSelectorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); - + parent_class = g_type_class_ref (GTK_TYPE_DIALOG); - + object_class->finalize = em_folder_selector_finalize; gtk_object_class->destroy = em_folder_selector_destroy; } @@ -111,13 +111,13 @@ em_folder_selector_destroy (GtkObject *obj) { EMFolderSelector *emfs = (EMFolderSelector *) obj; EMFolderTreeModel *model; - + if (emfs->created_id != 0) { model = em_folder_tree_get_model (emfs->emft); g_signal_handler_disconnect (model, emfs->created_id); emfs->created_id = 0; } - + GTK_OBJECT_CLASS (parent_class)->destroy (obj); } @@ -125,11 +125,11 @@ static void em_folder_selector_finalize (GObject *obj) { EMFolderSelector *emfs = (EMFolderSelector *) obj; - + g_free (emfs->selected_path); g_free (emfs->selected_uri); g_free (emfs->created_uri); - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -138,10 +138,10 @@ emfs_response (GtkWidget *dialog, int response, EMFolderSelector *emfs) { if (response != EM_FOLDER_SELECTOR_RESPONSE_NEW) return; - + g_object_set_data ((GObject *)emfs->emft, "select", GUINT_TO_POINTER (1)); em_folder_utils_create_folder(NULL, emfs->emft); - + g_signal_stop_emission_by_name (emfs, "response"); } @@ -151,10 +151,10 @@ emfs_create_name_changed (GtkEntry *entry, EMFolderSelector *emfs) char *path; const char *text = NULL; gboolean active; - + if (emfs->name_entry->text_length > 0) text = gtk_entry_get_text (emfs->name_entry); - + path = em_folder_tree_get_selected_uri(emfs->emft); active = text && path && !strchr (text, '/'); g_free(path); @@ -181,42 +181,42 @@ void em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint32 flags, const char *title, const char *text, const char *oklabel) { GtkWidget *label; - + gtk_window_set_modal (GTK_WINDOW (emfs), FALSE); gtk_window_set_default_size (GTK_WINDOW (emfs), 350, 300); gtk_window_set_title (GTK_WINDOW (emfs), title); gtk_container_set_border_width (GTK_CONTAINER (emfs), 6); - + gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (emfs)->vbox), 6); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (emfs)->vbox), 6); - + emfs->flags = flags; if (flags & EM_FOLDER_SELECTOR_CAN_CREATE) { gtk_dialog_add_button (GTK_DIALOG (emfs), GTK_STOCK_NEW, EM_FOLDER_SELECTOR_RESPONSE_NEW); g_signal_connect (emfs, "response", G_CALLBACK (emfs_response), emfs); } - + gtk_dialog_add_buttons (GTK_DIALOG (emfs), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, oklabel?oklabel:GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - + gtk_dialog_set_response_sensitive (GTK_DIALOG (emfs), GTK_RESPONSE_OK, FALSE); gtk_dialog_set_default_response (GTK_DIALOG (emfs), GTK_RESPONSE_OK); - + emfs->emft = emft; gtk_widget_show ((GtkWidget *) emft); - + g_signal_connect (emfs->emft, "folder-selected", G_CALLBACK (folder_selected_cb), emfs); g_signal_connect (emfs->emft, "folder-activated", G_CALLBACK (folder_activated_cb), emfs); gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), (GtkWidget *)emft, TRUE, TRUE, 6); - + if (text != NULL) { label = gtk_label_new (text); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_widget_show (label); - + gtk_box_pack_end (GTK_BOX (GTK_DIALOG (emfs)->vbox), label, FALSE, TRUE, 6); } - + gtk_widget_grab_focus ((GtkWidget *) emfs->emft); } @@ -224,10 +224,10 @@ GtkWidget * em_folder_selector_new (EMFolderTree *emft, guint32 flags, const char *title, const char *text, const char *oklabel) { EMFolderSelector *emfs; - + emfs = g_object_new (em_folder_selector_get_type (), NULL); em_folder_selector_construct (emfs, emft, flags, title, text, oklabel); - + return (GtkWidget *) emfs; } @@ -238,10 +238,10 @@ emfs_create_name_activate (GtkEntry *entry, EMFolderSelector *emfs) if (emfs->name_entry->text_length > 0) { char *path; const char *text; - + text = gtk_entry_get_text (emfs->name_entry); path = em_folder_tree_get_selected_uri(emfs->emft); - + if (text && path && !strchr (text, '/')) g_signal_emit_by_name (emfs, "response", GTK_RESPONSE_OK); g_free(path); @@ -253,15 +253,15 @@ em_folder_selector_create_new (EMFolderTree *emft, guint32 flags, const char *ti { EMFolderSelector *emfs; GtkWidget *hbox, *w; - + /* remove the CREATE flag if it is there since that's the * whole purpose of this dialog */ flags &= ~EM_FOLDER_SELECTOR_CAN_CREATE; - + emfs = g_object_new (em_folder_selector_get_type (), NULL); em_folder_selector_construct (emfs, emft, flags, title, text, _("Create")); em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOINFERIORS); - + hbox = gtk_hbox_new (FALSE, 0); w = gtk_label_new_with_mnemonic (_("Folder _name:")); gtk_box_pack_start ((GtkBox *) hbox, w, FALSE, FALSE, 6); @@ -271,11 +271,11 @@ em_folder_selector_create_new (EMFolderTree *emft, guint32 flags, const char *ti g_signal_connect (emfs->name_entry, "activate", G_CALLBACK (emfs_create_name_activate), emfs); gtk_box_pack_start ((GtkBox *) hbox, (GtkWidget *) emfs->name_entry, TRUE, FALSE, 6); gtk_widget_show_all (hbox); - + gtk_box_pack_start ((GtkBox *) ((GtkDialog *) emfs)->vbox, hbox, FALSE, TRUE, 0); - + gtk_widget_grab_focus ((GtkWidget *) emfs->name_entry); - + return (GtkWidget *) emfs; } @@ -297,28 +297,28 @@ em_folder_selector_get_selected_uri (EMFolderSelector *emfs) { char *uri; const char *name; - + if (!(uri = em_folder_tree_get_selected_uri (emfs->emft))) { d(printf ("no selected folder?\n")); return NULL; } - + if (uri && emfs->name_entry) { CamelProvider *provider; CamelURL *url; char *newpath; - + provider = camel_provider_get(uri, NULL); - + name = gtk_entry_get_text (emfs->name_entry); - + url = camel_url_new (uri, NULL); if (provider && (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH)) { if (url->fragment) newpath = g_strdup_printf ("%s/%s", url->fragment, name); else newpath = g_strdup (name); - + camel_url_set_fragment (url, newpath); } else { char *path; @@ -331,17 +331,17 @@ em_folder_selector_get_selected_uri (EMFolderSelector *emfs) } else newpath = path; } - + g_free (emfs->selected_path); emfs->selected_path = newpath; - + g_free (emfs->selected_uri); emfs->selected_uri = camel_url_to_string (url, 0); - + camel_url_free (url); uri = emfs->selected_uri; } - + return uri; } @@ -361,7 +361,7 @@ const char * em_folder_selector_get_selected_path (EMFolderSelector *emfs) { char *uri, *path; - + if (emfs->selected_path) { /* already did the work in a previous call */ return emfs->selected_path; @@ -377,7 +377,7 @@ em_folder_selector_get_selected_path (EMFolderSelector *emfs) if (emfs->name_entry) { const char *name; char *newpath; - + name = gtk_entry_get_text (emfs->name_entry); newpath = g_strdup_printf ("%s/%s", path?path:"", name); diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h index 1b5a0d31c9..7df2743c7c 100644 --- a/mail/em-folder-selector.h +++ b/mail/em-folder-selector.h @@ -42,21 +42,21 @@ typedef struct _EMFolderSelectorClass EMFolderSelectorClass; struct _EMFolderSelector { GtkDialog parent; - + guint32 flags; struct _EMFolderTree *emft; - + struct _GtkEntry *name_entry; char *selected_path; char *selected_uri; - + char *created_uri; guint created_id; }; struct _EMFolderSelectorClass { GtkDialogClass parent_class; - + }; enum { diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c index 9048969fef..5f4c67fc6e 100644 --- a/mail/em-folder-tree-model.c +++ b/mail/em-folder-tree-model.c @@ -100,7 +100,7 @@ GType em_folder_tree_model_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMFolderTreeModelClass), @@ -123,15 +123,15 @@ em_folder_tree_model_get_type (void) NULL, NULL }; - + type = g_type_register_static (GTK_TYPE_TREE_STORE, "EMFolderTreeModel", &info, 0); - + g_type_add_interface_static (type, GTK_TYPE_TREE_MODEL, &tree_model_info); g_type_add_interface_static (type, GTK_TYPE_TREE_SORTABLE, &sortable_info); } - + return type; } @@ -140,11 +140,11 @@ static void em_folder_tree_model_class_init (EMFolderTreeModelClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - + parent_class = g_type_class_ref (GTK_TYPE_TREE_STORE); - + object_class->finalize = em_folder_tree_model_finalize; - + /* signals */ signals[LOADING_ROW] = g_signal_new ("loading-row", @@ -156,7 +156,7 @@ em_folder_tree_model_class_init (EMFolderTreeModelClass *klass) G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); - + signals[LOADED_ROW] = g_signal_new ("loaded-row", G_OBJECT_CLASS_TYPE (object_class), @@ -167,7 +167,7 @@ em_folder_tree_model_class_init (EMFolderTreeModelClass *klass) G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); - + signals[FOLDER_ADDED] = g_signal_new ("folder-added", G_OBJECT_CLASS_TYPE (object_class), @@ -189,12 +189,12 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data gboolean is_store; guint32 aflags, bflags; int rv = -2; - + gtk_tree_model_get (model, a, COL_BOOL_IS_STORE, &is_store, COL_POINTER_CAMEL_STORE, &store, COL_STRING_DISPLAY_NAME, &aname, COL_UINT_FLAGS, &aflags, -1); gtk_tree_model_get (model, b, COL_STRING_DISPLAY_NAME, &bname, COL_UINT_FLAGS, &bflags, -1); - + if (is_store) { /* On This Computer is always first and Search Folders is always last */ if (!strcmp (aname, _("On This Computer"))) @@ -218,19 +218,19 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data else if ((bflags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX) rv = 1; } - + if (aname == NULL) { if (bname == NULL) rv = 0; } else if (bname == NULL) rv = 1; - + if (rv == -2) rv = g_utf8_collate (aname, bname); - + g_free (aname); g_free (bname); - + return rv; } @@ -242,7 +242,7 @@ store_info_free (struct _EMFolderTreeModelStoreInfo *si) camel_object_remove_event (si->store, si->renamed_id); camel_object_remove_event (si->store, si->subscribed_id); camel_object_remove_event (si->store, si->unsubscribed_id); - + g_free (si->display_name); camel_object_unref (si->store); gtk_tree_row_reference_free (si->row); @@ -262,9 +262,9 @@ em_folder_tree_model_init (EMFolderTreeModel *model) g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) gtk_tree_row_reference_free); - + gtk_tree_sortable_set_default_sort_func ((GtkTreeSortable *) model, sort_cb, NULL, NULL); - + model->accounts = mail_config_get_accounts (); model->account_hash = g_hash_table_new (g_direct_hash, g_direct_equal); model->account_changed_id = g_signal_connect (model->accounts, "account-changed", G_CALLBACK (account_changed), model); @@ -275,18 +275,18 @@ static void em_folder_tree_model_finalize (GObject *obj) { EMFolderTreeModel *model = (EMFolderTreeModel *) obj; - + g_free (model->filename); if (model->state) xmlFreeDoc (model->state); - + g_hash_table_destroy (model->store_hash); g_hash_table_destroy (model->uri_hash); - + g_hash_table_destroy (model->account_hash); g_signal_handler_disconnect (model->accounts, model->account_changed_id); g_signal_handler_disconnect (model->accounts, model->account_removed_id); - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -308,22 +308,22 @@ static void em_folder_tree_model_load_state (EMFolderTreeModel *model, const char *filename) { xmlNodePtr root, node; - + if (model->state) xmlFreeDoc (model->state); - + if ((model->state = e_xml_parse_file (filename))) return; - + /* setup some defaults - expand "Local Folders" and "Search Folders" */ model->state = xmlNewDoc ((const unsigned char *)"1.0"); root = xmlNewDocNode (model->state, NULL, (const unsigned char *)"tree-state", NULL); xmlDocSetRootElement (model->state, root); - + node = xmlNewChild (root, NULL, (const unsigned char *)"node", NULL); xmlSetProp (node, (const unsigned char *)"name", (const unsigned char *)"local"); xmlSetProp (node, (const unsigned char *)"expand", (const unsigned char *)"true"); - + node = xmlNewChild (root, NULL, (const unsigned char *)"node", NULL); xmlSetProp (node, (const unsigned char *)"name", (const unsigned char *)"vfolder"); xmlSetProp (node, (const unsigned char *)"expand", (const unsigned char *)"true"); @@ -335,17 +335,17 @@ em_folder_tree_model_new (const char *evolution_dir) { EMFolderTreeModel *model; char *filename; - + model = g_object_new (EM_TYPE_FOLDER_TREE_MODEL, NULL); gtk_tree_store_set_column_types ((GtkTreeStore *) model, NUM_COLUMNS, col_types); gtk_tree_sortable_set_sort_column_id ((GtkTreeSortable *) model, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); - + filename = g_build_filename (evolution_dir, "mail", "config", "folder-tree-expand-state.xml", NULL); em_folder_tree_model_load_state (model, filename); model->filename = filename; - + return model; } @@ -359,31 +359,31 @@ account_changed (EAccountList *accounts, EAccount *account, gpointer user_data) CamelStore *store; CamelException ex; char *uri; - + if (!(si = g_hash_table_lookup (model->account_hash, account))) return; - + em_folder_tree_model_remove_store (model, si->store); - + /* check if store needs to be added at all*/ if (!account->enabled ||!(uri = account->source->url)) return; - + camel_exception_init (&ex); if (!(provider = camel_provider_get(uri, &ex))) { camel_exception_clear (&ex); return; } - + /* make sure the new store belongs in the tree */ if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) return; - + if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) { camel_exception_clear (&ex); return; } - + em_folder_tree_model_add_store (model, store, account->name); camel_object_unref (store); } @@ -393,10 +393,10 @@ account_removed (EAccountList *accounts, EAccount *account, gpointer user_data) { EMFolderTreeModel *model = user_data; struct _EMFolderTreeModelStoreInfo *si; - + if (!(si = g_hash_table_lookup (model->account_hash, account))) return; - + em_folder_tree_model_remove_store (model, si->store); } @@ -417,15 +417,15 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite if (!fully_loaded) load = fi->child == NULL && !(fi->flags & (CAMEL_FOLDER_NOCHILDREN | CAMEL_FOLDER_NOINFERIORS)); - + path = gtk_tree_model_get_path ((GtkTreeModel *) model, iter); uri_row = gtk_tree_row_reference_new ((GtkTreeModel *) model, path); path_row = gtk_tree_row_reference_copy (uri_row); gtk_tree_path_free (path); - + g_hash_table_insert (model->uri_hash, g_strdup (fi->uri), uri_row); g_hash_table_insert (si->full_hash, g_strdup (fi->full_name), path_row); - + /* HACK: if we have the folder, and its the outbox folder, we need the total count, not unread */ /* HACK2: We do the same to the draft folder */ /* This is duplicated in mail-folder-cache too, should perhaps be functionised */ @@ -433,26 +433,26 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite if (mail_note_get_folder_from_uri(fi->uri, &folder) && folder) { if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)) { int total; - + if ((total = camel_folder_get_message_count (folder)) > 0) { int deleted = camel_folder_get_deleted_message_count (folder); - + if (deleted != -1) total -= deleted; } - + unread = total > 0 ? total : 0; - } + } if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) { int total; - + if ((total = camel_folder_get_message_count (folder)) > 0) { int deleted = camel_folder_get_deleted_message_count (folder); - + if (deleted != -1) total -= deleted; } - + unread = total > 0 ? total : 0; } camel_object_unref(folder); @@ -489,7 +489,7 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite if (unread != ~0) gtk_tree_store_set ((GtkTreeStore *) model, iter, COL_UINT_UNREAD, unread, -1); - + if (load) { /* create a placeholder node for our subfolders... */ gtk_tree_store_append ((GtkTreeStore *) model, &sub, iter); @@ -502,31 +502,31 @@ em_folder_tree_model_set_folder_info (EMFolderTreeModel *model, GtkTreeIter *ite COL_STRING_URI, NULL, COL_UINT_UNREAD, 0, -1); - + path = gtk_tree_model_get_path ((GtkTreeModel *) model, iter); g_signal_emit (model, signals[LOADING_ROW], 0, path, iter); gtk_tree_path_free (path); return; } - + if (fi->child) { fi = fi->child; - + do { gtk_tree_store_append ((GtkTreeStore *) model, &sub, iter); - + if (!emitted) { path = gtk_tree_model_get_path ((GtkTreeModel *) model, iter); g_signal_emit (model, signals[LOADED_ROW], 0, path, iter); gtk_tree_path_free (path); emitted = TRUE; } - + em_folder_tree_model_set_folder_info (model, &sub, si, fi, fully_loaded); fi = fi->next; } while (fi); } - + if (!emitted) { path = gtk_tree_model_get_path ((GtkTreeModel *) model, iter); g_signal_emit (model, signals[LOADED_ROW], 0, path, iter); @@ -547,11 +547,11 @@ folder_subscribed (CamelStore *store, CamelFolderInfo *fi, EMFolderTreeModel *mo if (!(si = g_hash_table_lookup (model->store_hash, store))) goto done; - + /* make sure we don't already know about it? */ if (g_hash_table_lookup (si->full_hash, fi->full_name)) goto done; - + /* get our parent folder's path */ dirname = alloca(strlen(fi->full_name)+1); strcpy(dirname, fi->full_name); @@ -562,36 +562,36 @@ folder_subscribed (CamelStore *store, CamelFolderInfo *fi, EMFolderTreeModel *mo } else { *p = 0; row = g_hash_table_lookup (si->full_hash, dirname); - + /* if row is NULL, don't bother adding to the tree, * when the user expands enough nodes - it will be * added auto-magically */ if (row == NULL) goto done; } - + path = gtk_tree_row_reference_get_path (row); if (!(gtk_tree_model_get_iter ((GtkTreeModel *) model, &parent, path))) { gtk_tree_path_free (path); goto done; } - + gtk_tree_path_free (path); - + /* make sure parent's subfolders have already been loaded */ gtk_tree_model_get ((GtkTreeModel *) model, &parent, COL_BOOL_LOAD_SUBDIRS, &load, -1); if (load) goto done; - + /* append a new node */ gtk_tree_store_append ((GtkTreeStore *) model, &iter, &parent); - + em_folder_tree_model_set_folder_info (model, &iter, si, fi, TRUE); g_signal_emit (model, signals[FOLDER_ADDED], 0, fi->full_name, fi->uri); - + done: - + camel_object_unref (store); camel_folder_info_free (fi); } @@ -600,7 +600,7 @@ static void folder_subscribed_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model) { CamelFolderInfo *fi; - + camel_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_subscribed, store, fi, model); @@ -613,23 +613,23 @@ folder_unsubscribed (CamelStore *store, CamelFolderInfo *fi, EMFolderTreeModel * GtkTreeRowReference *row; GtkTreePath *path; GtkTreeIter iter; - + if (!(si = g_hash_table_lookup (model->store_hash, store))) goto done; - + if (!(row = g_hash_table_lookup (si->full_hash, fi->full_name))) goto done; - + path = gtk_tree_row_reference_get_path (row); if (!(gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, path))) { gtk_tree_path_free (path); goto done; } - + em_folder_tree_model_remove_folders (model, si, &iter); - + done: - + camel_object_unref (store); camel_folder_info_free (fi); } @@ -638,7 +638,7 @@ static void folder_unsubscribed_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model) { CamelFolderInfo *fi; - + camel_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_unsubscribed, store, fi, model); @@ -652,7 +652,7 @@ folder_created_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model /* we only want created events to do more work if we don't support subscriptions */ if (camel_store_supports_subscriptions (store)) return; - + camel_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_subscribed, store, fi, model); @@ -662,11 +662,11 @@ static void folder_deleted_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model) { CamelFolderInfo *fi; - + /* we only want deleted events to do more work if we don't support subscriptions */ if (camel_store_supports_subscriptions (store)) return; - + camel_object_ref (store); fi = camel_folder_info_clone (event_data); mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_unsubscribed_cb, store, fi, model); @@ -683,18 +683,18 @@ folder_renamed (CamelStore *store, CamelRenameInfo *info, EMFolderTreeModel *mod if (!(si = g_hash_table_lookup (model->store_hash, store))) goto done; - + if (!(row = g_hash_table_lookup (si->full_hash, info->old_base))) goto done; - + path = gtk_tree_row_reference_get_path (row); if (!(gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, path))) { gtk_tree_path_free (path); goto done; } - + em_folder_tree_model_remove_folders (model, si, &iter); - + parent = g_strdup(info->new->full_name); p = strrchr(parent, '/'); if (p) @@ -712,25 +712,25 @@ folder_renamed (CamelStore *store, CamelRenameInfo *info, EMFolderTreeModel *mod g_free (parent); goto done; } - + path = gtk_tree_row_reference_get_path (row); } - + g_free (parent); - + if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &root, path)) { gtk_tree_path_free (path); - g_warning ("This shouldn't be reached\n"); + g_warning ("This shouldn't be reached\n"); goto done; } - + gtk_tree_store_append ((GtkTreeStore *) model, &iter, &root); em_folder_tree_model_set_folder_info (model, &iter, si, info->new, TRUE); - + done: - + camel_object_unref (store); - + g_free (info->old_base); camel_folder_info_free (info->new); g_free (info); @@ -740,13 +740,13 @@ static void folder_renamed_cb (CamelStore *store, void *event_data, EMFolderTreeModel *model) { CamelRenameInfo *rinfo, *info = event_data; - + camel_object_ref (store); - + rinfo = g_new0 (CamelRenameInfo, 1); rinfo->old_base = g_strdup (info->old_base); rinfo->new = camel_folder_info_clone (info->new); - + mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) folder_renamed, store, rinfo, model); } @@ -759,18 +759,18 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con GtkTreePath *path; EAccount *account; char *uri; - + g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model)); g_return_if_fail (CAMEL_IS_STORE (store)); g_return_if_fail (display_name != NULL); - + if ((si = g_hash_table_lookup (model->store_hash, store))) em_folder_tree_model_remove_store (model, store); - + uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL); - + account = mail_config_get_account_by_source_url (uri); - + /* add the store to the tree */ gtk_tree_store_append ((GtkTreeStore *) model, &iter, NULL); gtk_tree_store_set ((GtkTreeStore *) model, &iter, @@ -780,10 +780,10 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con COL_BOOL_LOAD_SUBDIRS, TRUE, COL_BOOL_IS_STORE, TRUE, COL_STRING_URI, uri, -1); - + path = gtk_tree_model_get_path ((GtkTreeModel *) model, &iter); row = gtk_tree_row_reference_new ((GtkTreeModel *) model, path); - + si = g_new (struct _EMFolderTreeModelStoreInfo, 1); si->display_name = g_strdup (display_name); camel_object_ref (store); @@ -796,7 +796,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con (GDestroyNotify) gtk_tree_row_reference_free); g_hash_table_insert (model->store_hash, store, si); g_hash_table_insert (model->account_hash, account, si); - + /* each store has folders... but we don't load them until the user demands them */ root = iter; gtk_tree_store_append ((GtkTreeStore *) model, &iter, &root); @@ -809,9 +809,9 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con COL_STRING_URI, NULL, COL_UINT_UNREAD, 0, -1); - + g_free (uri); - + /* listen to store events */ #define CAMEL_CALLBACK(func) ((CamelObjectEventHookFunc) func) si->created_id = camel_object_hook_event (store, "folder_created", CAMEL_CALLBACK (folder_created_cb), model); @@ -819,7 +819,7 @@ em_folder_tree_model_add_store (EMFolderTreeModel *model, CamelStore *store, con si->renamed_id = camel_object_hook_event (store, "folder_renamed", CAMEL_CALLBACK (folder_renamed_cb), model); si->subscribed_id = camel_object_hook_event (store, "folder_subscribed", CAMEL_CALLBACK (folder_subscribed_cb), model); si->unsubscribed_id = camel_object_hook_event (store, "folder_unsubscribed", CAMEL_CALLBACK (folder_unsubscribed_cb), model); - + g_signal_emit (model, signals[LOADED_ROW], 0, path, &root); gtk_tree_path_free (path); } @@ -839,13 +839,13 @@ static void em_folder_tree_model_remove_store_info (EMFolderTreeModel *model, CamelStore *store) { struct _EMFolderTreeModelStoreInfo *si; - + g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model)); g_return_if_fail (CAMEL_IS_STORE (store)); - + if (!(si = g_hash_table_lookup (model->store_hash, store))) return; - + g_hash_table_remove (model->store_hash, si->store); g_hash_table_remove (model->account_hash, si->account); } @@ -857,32 +857,32 @@ em_folder_tree_model_remove_folders (EMFolderTreeModel *model, struct _EMFolderT char *uri, *full_name; gboolean is_store, go; GtkTreeIter iter; - + if (gtk_tree_model_iter_children ((GtkTreeModel *) model, &iter, toplevel)) { do { GtkTreeIter next = iter; - + go = gtk_tree_model_iter_next ((GtkTreeModel *) model, &next); em_folder_tree_model_remove_folders (model, si, &iter); iter = next; } while (go); } - + gtk_tree_model_get ((GtkTreeModel *) model, toplevel, COL_STRING_URI, &uri, COL_STRING_FULL_NAME, &full_name, COL_BOOL_IS_STORE, &is_store, -1); if (full_name) g_hash_table_remove (si->full_hash, full_name); - + if (uri) em_folder_tree_model_remove_uri (model, uri); - + gtk_tree_store_remove ((GtkTreeStore *) model, toplevel); - + if (is_store) em_folder_tree_model_remove_store_info (model, si->store); - + g_free (full_name); g_free (uri); } @@ -894,17 +894,17 @@ em_folder_tree_model_remove_store (EMFolderTreeModel *model, CamelStore *store) struct _EMFolderTreeModelStoreInfo *si; GtkTreePath *path; GtkTreeIter iter; - + g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model)); g_return_if_fail (CAMEL_IS_STORE (store)); - + if (!(si = g_hash_table_lookup (model->store_hash, store))) return; - + path = gtk_tree_row_reference_get_path (si->row); gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, path); gtk_tree_path_free (path); - + /* recursively remove subfolders and finally the toplevel store */ em_folder_tree_model_remove_folders (model, si, &iter); } @@ -915,7 +915,7 @@ find_xml_node (xmlNodePtr root, const char *name) { xmlNodePtr node; char *nname; - + node = root->children; while (node != NULL) { if (!strcmp ((char *)node->name, "node")) { @@ -924,13 +924,13 @@ find_xml_node (xmlNodePtr root, const char *name) xmlFree (nname); return node; } - + xmlFree (nname); } - + node = node->next; } - + return node; } @@ -948,31 +948,31 @@ em_folder_tree_model_get_expanded (EMFolderTreeModel *model, const char *key) node = model->state ? model->state->children : NULL; if (!node || strcmp ((char *)node->name, "tree-state") != 0) return FALSE; - + name = buf = g_alloca (strlen (key) + 1); p = g_stpcpy (buf, key); if (p[-1] == '/') p[-1] = '\0'; p = NULL; - + do { if ((p = strchr (name, '/'))) *p = '\0'; - + if ((node = find_xml_node (node, name))) { gboolean expanded; - + buf = (char *)xmlGetProp (node, (const unsigned char *)"expand"); expanded = buf && !strcmp ((char *)buf, "true"); xmlFree (buf); - + if (!expanded || p == NULL) return expanded; } - + name = p ? p + 1 : NULL; } while (name && node); - + return FALSE; } @@ -983,41 +983,41 @@ em_folder_tree_model_set_expanded (EMFolderTreeModel *model, const char *key, gb xmlNodePtr node, parent; const char *name; char *buf, *p; - + if (model->state == NULL) model->state = xmlNewDoc ((const unsigned char *)"1.0"); - + if (!model->state->children) { node = xmlNewDocNode (model->state, NULL, (const unsigned char *)"tree-state", NULL); xmlDocSetRootElement (model->state, node); } else { node = model->state->children; } - + name = buf = g_alloca (strlen (key) + 1); p = g_stpcpy (buf, key); if (p[-1] == '/') p[-1] = '\0'; p = NULL; - + do { parent = node; if ((p = strchr (name, '/'))) *p = '\0'; - + if (!(node = find_xml_node (node, name))) { if (!expanded) { /* node doesn't exist, so we don't need to set expanded to FALSE */ return; } - + /* node (or parent node) doesn't exist, need to add it */ node = xmlNewChild (parent, NULL, (const unsigned char *)"node", NULL); xmlSetProp (node, (const unsigned char *)"name", (unsigned char *)name); } - + xmlSetProp (node, (const unsigned char *)"expand", (const unsigned char *)(expanded || p ? "true" : "false")); - + name = p ? p + 1 : NULL; } while (name); } @@ -1049,7 +1049,7 @@ emftm_uri_to_key (const char *uri) } else { const char *path; EAccount *account; - + if (((CamelService *)store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) path = url->fragment; else @@ -1119,18 +1119,18 @@ void em_folder_tree_model_save_state (EMFolderTreeModel *model) { char *dirname; - + if (model->state == NULL) return; - + dirname = g_path_get_dirname (model->filename); if (g_mkdir_with_parents (dirname, 0777) == -1 && errno != EEXIST) { g_free (dirname); return; } - + g_free (dirname); - + e_xml_save_file (model->filename, model->state); } @@ -1140,28 +1140,28 @@ expand_foreach_r (EMFolderTreeModel *model, xmlNodePtr parent, const char *dirna { xmlNodePtr node = parent->children; char *path, *name, *expand; - + while (node != NULL) { if (!strcmp ((char *)node->name, "node")) { name = (char *)xmlGetProp (node, (const unsigned char *)"name"); expand = (char *)xmlGetProp (node, (const unsigned char *)"expand"); - + if (expand && name && !strcmp ((char *)expand, "true")) { if (dirname) path = g_strdup_printf ("%s/%s", dirname, name); else path = g_strdup (name); - + func (model, path, user_data); if (node->children) expand_foreach_r (model, node, path, func, user_data); g_free (path); } - + xmlFree (expand); xmlFree (name); } - + node = node->next; } } @@ -1170,11 +1170,11 @@ void em_folder_tree_model_expand_foreach (EMFolderTreeModel *model, EMFTModelExpandFunc func, void *user_data) { xmlNodePtr root; - + root = model->state ? model->state->children : NULL; if (!root || !root->children || strcmp ((char *)root->name, "tree-state") != 0) return; - + expand_foreach_r (model, root, NULL, func, user_data); } @@ -1197,12 +1197,12 @@ em_folder_tree_model_is_type_inbox (EMFolderTreeModel *model, CamelStore *store, u(printf(" can't find store\n")); return FALSE; } - + if (!(row = g_hash_table_lookup (si->full_hash, full))) { u(printf(" can't find row\n")); return FALSE; } - + tree_path = gtk_tree_row_reference_get_path (row); if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, tree_path)) { gtk_tree_path_free (tree_path); @@ -1210,7 +1210,7 @@ em_folder_tree_model_is_type_inbox (EMFolderTreeModel *model, CamelStore *store, } gtk_tree_path_free (tree_path); - + gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, COL_UINT_FLAGS, &flags, -1); if ((flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX) @@ -1226,7 +1226,7 @@ em_folder_tree_model_set_unread_count (EMFolderTreeModel *model, CamelStore *sto GtkTreeRowReference *row; GtkTreePath *tree_path; GtkTreeIter iter; - + g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model)); g_return_if_fail (CAMEL_IS_STORE (store)); g_return_if_fail (full != NULL); @@ -1235,25 +1235,25 @@ em_folder_tree_model_set_unread_count (EMFolderTreeModel *model, CamelStore *sto if (unread < 0) return; - + if (!(si = g_hash_table_lookup (model->store_hash, store))) { u(printf(" can't find store\n")); return; } - + if (!(row = g_hash_table_lookup (si->full_hash, full))) { u(printf(" can't find row\n")); return; } - + tree_path = gtk_tree_row_reference_get_path (row); if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &iter, tree_path)) { gtk_tree_path_free (tree_path); return; } - + gtk_tree_path_free (tree_path); - + gtk_tree_store_set ((GtkTreeStore *) model, &iter, COL_UINT_UNREAD, unread, -1); } @@ -1263,25 +1263,25 @@ em_folder_tree_model_get_selected (EMFolderTreeModel *model) { xmlNodePtr node; char *buf, *uri; - + node = model->state ? model->state->children : NULL; if (!node || strcmp ((char *)node->name, "tree-state") != 0) return NULL; - + node = node->children; while (node != NULL) { if (!strcmp ((char *)node->name, "selected")) break; node = node->next; } - + if (node == NULL) return NULL; - + buf = (char *)xmlGetProp (node, (unsigned char *)"uri"); uri = g_strdup (buf); xmlFree (buf); - + if (uri && !*uri) { g_free (uri); return NULL; @@ -1294,26 +1294,26 @@ void em_folder_tree_model_set_selected (EMFolderTreeModel *model, const char *uri) { xmlNodePtr root, node; - + if (model->state == NULL) model->state = xmlNewDoc ((unsigned char *)"1.0"); - + if (!model->state->children) { root = xmlNewDocNode (model->state, NULL, (const unsigned char *)"tree-state", NULL); xmlDocSetRootElement (model->state, root); } else { root = model->state->children; } - + node = root->children; while (node != NULL) { if (!strcmp ((char *)node->name, "selected")) break; node = node->next; } - + if (node == NULL) node = xmlNewChild (root, NULL, (const unsigned char *)"selected", NULL); - + xmlSetProp (node, (const unsigned char *)"uri", (unsigned char *)uri); } diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h index 9c5a4124d2..5360ed4390 100644 --- a/mail/em-folder-tree-model.h +++ b/mail/em-folder-tree-model.h @@ -70,9 +70,9 @@ struct _EMFolderTreeModelStoreInfo { GtkTreeRowReference *row; GHashTable *full_hash; /* maps CamelFolderInfo::full_name's to GtkTreeRowReferences */ EAccount *account; - + char *display_name; - + unsigned int created_id; unsigned int deleted_id; unsigned int renamed_id; @@ -82,13 +82,13 @@ struct _EMFolderTreeModelStoreInfo { struct _EMFolderTreeModel { GtkTreeStore parent_object; - + char *filename; /* state filename */ xmlDocPtr state; /* saved expanded state from previous session */ - + GHashTable *store_hash; /* maps CamelStore's to store-info's */ GHashTable *uri_hash; /* maps URI's to GtkTreeRowReferences */ - + EAccountList *accounts; GHashTable *account_hash; /* maps accounts to store-info's */ gulong account_changed_id; @@ -97,20 +97,20 @@ struct _EMFolderTreeModel { struct _EMFolderTreeModelClass { GtkTreeStoreClass parent_class; - + /* signals */ void (* loading_row) (EMFolderTreeModel *model, GtkTreePath *path, GtkTreeIter *iter); - + void (* loaded_row) (EMFolderTreeModel *model, GtkTreePath *path, GtkTreeIter *iter); - + void (* folder_added) (EMFolderTreeModel *model, const char *path, const char *uri); - + void (* store_added) (EMFolderTreeModel *model, const char *uri); }; diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index acf317a15c..adf8616755 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -86,10 +86,10 @@ struct _selected_uri { struct _EMFolderTreePrivate { GtkTreeView *treeview; EMFolderTreeModel *model; - + GSList *select_uris; /* selected_uri structures of each path pending selection. */ GHashTable *select_uris_table; /*Removed as they're encountered, so use this to find uri's not presnet but selected */ - + guint32 excluded; gboolean (*excluded_func)(EMFolderTree *emft, GtkTreeModel *model, GtkTreeIter *iter, void *data); void *excluded_data; @@ -99,16 +99,16 @@ struct _EMFolderTreePrivate { * else has set the cursor, otherwise * we need to set it when we set the * selection */ - + guint save_state_id; - + guint autoscroll_id; guint autoexpand_id; GtkTreeRowReference *autoexpand_row; - + guint loading_row_id; guint loaded_row_id; - + GtkTreeRowReference *drag_row; }; @@ -183,7 +183,7 @@ GType em_folder_tree_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMFolderTreeClass), @@ -196,10 +196,10 @@ em_folder_tree_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) em_folder_tree_init, }; - + type = g_type_register_static (GTK_TYPE_VBOX, "EMFolderTree", &info, 0); } - + return type; } @@ -209,14 +209,14 @@ em_folder_tree_class_init (EMFolderTreeClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - + parent_class = g_type_class_ref (GTK_TYPE_VBOX); - + object_class->finalize = em_folder_tree_finalize; gtk_object_class->destroy = em_folder_tree_destroy; widget_class->popup_menu = emft_popup_menu; - + signals[FOLDER_SELECTED] = g_signal_new ("folder-selected", G_OBJECT_CLASS_TYPE (object_class), @@ -228,7 +228,7 @@ em_folder_tree_class_init (EMFolderTreeClass *klass) G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); - + signals[FOLDER_ACTIVATED] = g_signal_new ("folder-activated", G_OBJECT_CLASS_TYPE (object_class), @@ -246,20 +246,20 @@ subdirs_contain_unread (GtkTreeModel *model, GtkTreeIter *root) { unsigned int unread; GtkTreeIter iter; - + if (!gtk_tree_model_iter_children (model, &iter, root)) return FALSE; - + do { gtk_tree_model_get (model, &iter, COL_UINT_UNREAD, &unread, -1); if (unread) return TRUE; - + if (gtk_tree_model_iter_has_child (model, &iter)) if (subdirs_contain_unread (model, &iter)) return TRUE; } while (gtk_tree_model_iter_next (model, &iter)); - + return FALSE; } @@ -287,7 +287,7 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer, GdkPixbuf *pixbuf = NULL; gboolean is_store; guint32 flags; - + if (!initialised) { folder_icons[FOLDER_ICON_NORMAL] = e_icon_factory_get_icon ("folder", E_ICON_SIZE_MENU); folder_icons[FOLDER_ICON_INBOX] = e_icon_factory_get_icon ("mail-inbox", E_ICON_SIZE_MENU); @@ -298,10 +298,10 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer, folder_icons[FOLDER_ICON_SHARED_BY_ME] = e_icon_factory_get_icon ("stock_shared-by-me", E_ICON_SIZE_MENU); folder_icons[FOLDER_ICON_SENT] = e_icon_factory_get_icon ("mail-sent", E_ICON_SIZE_MENU); folder_icons[FOLDER_ICON_VIRTUAL] = e_icon_factory_get_icon ("folder-saved-search", E_ICON_SIZE_MENU); - + initialised = TRUE; } - + gtk_tree_model_get (model, iter, COL_BOOL_IS_STORE, &is_store, COL_UINT_FLAGS, &flags, -1); if (!is_store) { @@ -322,9 +322,9 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer, pixbuf = folder_icons[FOLDER_ICON_SENT]; break; default: - if (flags & CAMEL_FOLDER_SHARED_TO_ME) + if (flags & CAMEL_FOLDER_SHARED_TO_ME) pixbuf = folder_icons[FOLDER_ICON_SHARED_TO_ME]; - else if (flags & CAMEL_FOLDER_SHARED_BY_ME) + else if (flags & CAMEL_FOLDER_SHARED_BY_ME) pixbuf = folder_icons[FOLDER_ICON_SHARED_BY_ME]; else if (flags & CAMEL_FOLDER_VIRTUAL) pixbuf = folder_icons[FOLDER_ICON_VIRTUAL]; @@ -332,7 +332,7 @@ render_pixbuf (GtkTreeViewColumn *column, GtkCellRenderer *renderer, pixbuf = folder_icons[FOLDER_ICON_NORMAL]; } } - + g_object_set (renderer, "pixbuf", pixbuf, "visible", !is_store, NULL); } @@ -344,16 +344,16 @@ render_display_name (GtkTreeViewColumn *column, GtkCellRenderer *renderer, unsigned int unread; char *display; char *name; - + gtk_tree_model_get (model, iter, COL_STRING_DISPLAY_NAME, &name, COL_BOOL_IS_STORE, &is_store, COL_UINT_UNREAD, &unread, -1); - + if (!(bold = is_store || unread)) { if (gtk_tree_model_iter_has_child (model, iter)) bold = subdirs_contain_unread (model, iter); } - + if (!is_store && unread) { /* Translators: This is the string used for displaying the * folder names in folder trees. "%s" will be replaced by @@ -374,11 +374,11 @@ render_display_name (GtkTreeViewColumn *column, GtkCellRenderer *renderer, g_free (name); } else display = name; - + g_object_set (renderer, "text", display, "weight", bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, NULL); - + g_free (display); } @@ -424,7 +424,7 @@ static void em_folder_tree_init (EMFolderTree *emft) { struct _EMFolderTreePrivate *priv; - + priv = g_new0 (struct _EMFolderTreePrivate, 1); priv->select_uris_table = g_hash_table_new(g_str_hash, g_str_equal); priv->treeview = NULL; @@ -447,7 +447,7 @@ em_folder_tree_finalize (GObject *obj) } g_free (emft->priv); - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -456,38 +456,38 @@ em_folder_tree_destroy (GtkObject *obj) { EMFolderTree *emft = (EMFolderTree *) obj; struct _EMFolderTreePrivate *priv = emft->priv; - + if (priv->loading_row_id != 0) { g_signal_handler_disconnect (priv->model, priv->loading_row_id); priv->loading_row_id = 0; } - + if (priv->loaded_row_id != 0) { g_signal_handler_disconnect (priv->model, priv->loaded_row_id); priv->loaded_row_id = 0; } - + if (priv->save_state_id != 0) { g_source_remove (priv->save_state_id); emft_save_state (emft); } - + if (priv->autoscroll_id != 0) { g_source_remove (priv->autoscroll_id); priv->autoscroll_id = 0; } - + if (priv->autoexpand_id != 0) { gtk_tree_row_reference_free (priv->autoexpand_row); priv->autoexpand_row = NULL; - + g_source_remove (priv->autoexpand_id); priv->autoexpand_id = 0; } - + priv->treeview = NULL; priv->model = NULL; - + GTK_OBJECT_CLASS (parent_class)->destroy (obj); } @@ -501,24 +501,24 @@ folder_tree_new (EMFolderTree *emft, EMFolderTreeModel *model) gboolean side_bar_search; GConfClient *gconf; - gconf = mail_config_get_gconf_client (); + gconf = mail_config_get_gconf_client (); side_bar_search = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/side_bar_search", NULL); - + tree = gtk_tree_view_new_with_model ((GtkTreeModel *) model); GTK_WIDGET_SET_FLAGS(tree, GTK_CAN_FOCUS); - + column = gtk_tree_view_column_new (); gtk_tree_view_append_column ((GtkTreeView *) tree, column); - + renderer = gtk_cell_renderer_pixbuf_new (); gtk_tree_view_column_pack_start (column, renderer, FALSE); gtk_tree_view_column_set_cell_data_func (column, renderer, render_pixbuf, NULL, NULL); - + renderer = gtk_cell_renderer_text_new (); g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_tree_view_column_pack_start (column, renderer, TRUE); gtk_tree_view_column_set_cell_data_func (column, renderer, render_display_name, NULL, NULL); - + selection = gtk_tree_view_get_selection ((GtkTreeView *) tree); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); gtk_tree_selection_set_select_function(selection, emft_select_func, emft, NULL); @@ -536,29 +536,29 @@ em_folder_tree_construct (EMFolderTree *emft, EMFolderTreeModel *model) struct _EMFolderTreePrivate *priv = emft->priv; GtkTreeSelection *selection; GtkWidget *scrolled; - + scrolled = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN); - + priv->model = model; priv->treeview = folder_tree_new (emft, model); gtk_widget_show ((GtkWidget *) priv->treeview); - + g_signal_connect (priv->model, "row-changed", G_CALLBACK (emft_model_row_changed), emft); g_signal_connect (priv->treeview, "row-expanded", G_CALLBACK (emft_tree_row_expanded), emft); g_signal_connect (priv->treeview, "test-collapse-row", G_CALLBACK (emft_tree_test_collapse_row), emft); g_signal_connect (priv->treeview, "row-activated", G_CALLBACK (emft_tree_row_activated), emft); g_signal_connect (priv->treeview, "button-press-event", G_CALLBACK (emft_tree_button_press), emft); g_signal_connect (priv->treeview, "key-press-event", G_CALLBACK (emft_tree_user_event), emft); - + selection = gtk_tree_view_get_selection ((GtkTreeView *) priv->treeview); g_signal_connect (selection, "changed", G_CALLBACK (emft_tree_selection_changed), emft); - + gtk_container_add ((GtkContainer *) scrolled, (GtkWidget *) priv->treeview); gtk_widget_show (scrolled); - + gtk_box_pack_start ((GtkBox *) emft, scrolled, TRUE, TRUE, 0); } @@ -567,16 +567,16 @@ em_folder_tree_new (void) { EMFolderTreeModel *model; EMFolderTree *emft; - + model = em_folder_tree_model_new (mail_component_peek_base_directory (mail_component_peek ())); emft = (EMFolderTree *) em_folder_tree_new_with_model (model); g_object_unref (model); - + return (GtkWidget *) emft; } /* NOTE: Removes and frees the selected uri structure */ -static void +static void emft_select_uri(EMFolderTree *emft, GtkTreePath *path, struct _selected_uri *u) { struct _EMFolderTreePrivate *priv = emft->priv; @@ -613,47 +613,47 @@ emft_expand_node (EMFolderTreeModel *model, const char *key, EMFolderTree *emft) n = strlen (key); else n = (p - key); - + uid = g_alloca (n + 1); memcpy (uid, key, n); uid[n] = '\0'; - + if ((account = mail_config_get_account_by_uid (uid)) && account->enabled) { CamelException ex; - + camel_exception_init (&ex); store = (CamelStore *) camel_session_get_service (session, account->source->url, CAMEL_PROVIDER_STORE, &ex); camel_exception_clear (&ex); - + if (store == NULL) return; } else if (!strcmp (uid, "vfolder")) { if (!(store = vfolder_store)) return; - + camel_object_ref (store); } else if (!strcmp (uid, "local")) { if (!(store = mail_component_peek_local_store (NULL))) return; - + camel_object_ref (store); } else { return; } - + if (!(si = g_hash_table_lookup (priv->model->store_hash, store))) { camel_object_unref (store); return; } - + camel_object_unref (store); - + if (p != NULL) { if (!(row = g_hash_table_lookup (si->full_hash, p + 1))) return; } else row = si->row; - + path = gtk_tree_row_reference_get_path (row); gtk_tree_view_expand_row (priv->treeview, path, FALSE); @@ -682,7 +682,7 @@ emft_maybe_expand_row (EMFolderTreeModel *model, GtkTreePath *tree_path, GtkTree COL_POINTER_CAMEL_STORE, &store, COL_BOOL_IS_STORE, &is_store, -1); - + si = g_hash_table_lookup (model->store_hash, store); if ((account = mail_config_get_account_by_name (si->display_name))) { key = g_strdup_printf ("%s/%s", account->uid, full_name ? full_name : ""); @@ -720,19 +720,19 @@ em_folder_tree_new_with_model (EMFolderTreeModel *model) { EMFolderTree *emft; AtkObject *a11y; - + emft = g_object_new (EM_TYPE_FOLDER_TREE, NULL); em_folder_tree_construct (emft, model); g_object_ref (model); - + em_folder_tree_model_expand_foreach (model, (EMFTModelExpandFunc)emft_expand_node, emft); - + emft->priv->loading_row_id = g_signal_connect (model, "loading-row", G_CALLBACK (emft_maybe_expand_row), emft); emft->priv->loaded_row_id = g_signal_connect (model, "loaded-row", G_CALLBACK (emft_maybe_expand_row), emft); a11y = gtk_widget_get_accessible (GTK_WIDGET (emft->priv->treeview)); atk_object_set_name (a11y, _("Mail Folder Tree")); - + return (GtkWidget *) emft; } @@ -744,15 +744,15 @@ tree_drag_begin (GtkWidget *widget, GdkDragContext *context, EMFolderTree *emft) GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; - + selection = gtk_tree_view_get_selection ((GtkTreeView *) widget); if (!gtk_tree_selection_get_selected (selection, &model, &iter)) return; - + path = gtk_tree_model_get_path (model, &iter); priv->drag_row = gtk_tree_row_reference_new (model, path); gtk_tree_path_free (path); - + /* FIXME: set a drag icon? */ } @@ -766,10 +766,10 @@ tree_drag_data_delete(GtkWidget *widget, GdkDragContext *context, EMFolderTree * CamelStore *store; CamelException ex; GtkTreeIter iter; - + if (!priv->drag_row || (src_path = gtk_tree_row_reference_get_path (priv->drag_row))) return; - + if (!gtk_tree_model_get_iter((GtkTreeModel *)priv->model, &iter, src_path)) goto fail; @@ -777,10 +777,10 @@ tree_drag_data_delete(GtkWidget *widget, GdkDragContext *context, EMFolderTree * COL_POINTER_CAMEL_STORE, &store, COL_STRING_FULL_NAME, &full_name, COL_BOOL_IS_STORE, &is_store, -1); - + if (is_store) goto fail; - + camel_exception_init(&ex); camel_store_delete_folder(store, full_name, &ex); if (camel_exception_is_set(&ex)) @@ -800,24 +800,24 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData CamelStore *store; CamelException ex; GtkTreeIter iter; - + if (!priv->drag_row || !(src_path = gtk_tree_row_reference_get_path(priv->drag_row))) return; - + if (!gtk_tree_model_get_iter((GtkTreeModel *)priv->model, &iter, src_path)) goto fail; - + gtk_tree_model_get((GtkTreeModel *)priv->model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_STRING_FULL_NAME, &full_name, COL_STRING_URI, &uri, -1); - + /* make sure user isn't trying to drag on a placeholder row */ if (full_name == NULL) goto fail; - + camel_exception_init(&ex); - + switch (info) { case DND_DRAG_TYPE_FOLDER: /* dragging to a new location in the folder tree */ @@ -827,7 +827,7 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData /* dragging to nautilus or something, probably */ if ((folder = camel_store_get_folder(store, full_name, 0, &ex))) { GPtrArray *uids = camel_folder_get_uids(folder); - + em_utils_selection_set_urilist(selection, folder, uids); camel_folder_free_uids(folder, uids); camel_object_unref(folder); @@ -836,7 +836,7 @@ tree_drag_data_get(GtkWidget *widget, GdkDragContext *context, GtkSelectionData default: abort(); } - + if (camel_exception_is_set(&ex)) camel_exception_clear(&ex); fail: @@ -849,7 +849,7 @@ fail: /* Drop handling */ struct _DragDataReceivedAsync { struct _mail_msg msg; - + /* input data */ GdkDragContext *context; @@ -860,7 +860,7 @@ struct _DragDataReceivedAsync { char *full_name; guint32 action; guint info; - + unsigned int move:1; unsigned int moved:1; unsigned int aborted:1; @@ -886,17 +886,17 @@ emft_drop_async_desc (struct _mail_msg *mm, int done) struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; CamelURL *url; char *buf; - + if (m->info == DND_DROP_TYPE_FOLDER) { url = camel_url_new ((char *)m->selection->data, NULL); - + if (m->move) buf = g_strdup_printf (_("Moving folder %s"), url->fragment ? url->fragment : url->path + 1); else buf = g_strdup_printf (_("Copying folder %s"), url->fragment ? url->fragment : url->path + 1); - + camel_url_free (url); - + return buf; } else { if (m->move) @@ -911,7 +911,7 @@ emft_drop_async_drop (struct _mail_msg *mm) { struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; CamelFolder *folder; - + /* for types other than folder, we can't drop to the root path */ if (m->info == DND_DROP_TYPE_FOLDER) { /* copy or move (aka rename) a folder */ @@ -945,7 +945,7 @@ static void emft_drop_async_free (struct _mail_msg *mm) { struct _DragDataReceivedAsync *m = (struct _DragDataReceivedAsync *) mm; - + g_object_unref(m->context); camel_object_unref(m->store); g_free(m->full_name); @@ -1025,23 +1025,23 @@ tree_drag_data_received(GtkWidget *widget, GdkDragContext *context, int x, int y if (!gtk_tree_view_get_dest_row_at_pos (priv->treeview, x, y, &dest_path, &pos)) return; - + /* this means we are receiving no data */ if (!selection->data || selection->length == -1) { gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME); return; } - + if (!gtk_tree_model_get_iter((GtkTreeModel *)priv->model, &iter, dest_path)) { gtk_drag_finish(context, FALSE, FALSE, GDK_CURRENT_TIME); return; } - + gtk_tree_model_get((GtkTreeModel *)priv->model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_BOOL_IS_STORE, &is_store, COL_STRING_FULL_NAME, &full_name, -1); - + /* make sure user isn't try to drop on a placeholder row */ if (full_name == NULL && !is_store) { gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); @@ -1105,61 +1105,61 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) gboolean is_store; GtkTreeIter iter; GList *targets; - + /* This is a bit of a mess, but should handle all the cases properly */ if (!gtk_tree_model_get_iter((GtkTreeModel *)p->model, &iter, path)) return GDK_NONE; - + gtk_tree_model_get((GtkTreeModel *)p->model, &iter, COL_BOOL_IS_STORE, &is_store, COL_STRING_FULL_NAME, &full_name, COL_POINTER_CAMEL_STORE, &dstore, COL_STRING_URI, &uri, -1); - + local = mail_component_peek_local_store (NULL); - + targets = context->targets; - + /* Check for special destinations */ if (uri && full_name) { #if 0 /* only allow copying/moving folders (not messages) into the local Outbox */ if (dstore == local && !strcmp (full_name, "Outbox")) { GdkAtom xfolder; - + xfolder = drop_atoms[DND_DROP_TYPE_FOLDER]; while (targets != NULL) { if (targets->data == (gpointer) xfolder) { atom = xfolder; goto done; } - + targets = targets->next; } - + goto done; } #endif - + /* don't allow copying/moving into the UNMATCHED vfolder */ if (!strncmp (uri, "vfolder:", 8) && !strcmp (full_name, CAMEL_UNMATCHED_NAME)) goto done; - + /* don't allow copying/moving into a vTrash/vJunk folder */ if (!strcmp (full_name, CAMEL_VTRASH_NAME) || !strcmp (full_name, CAMEL_VJUNK_NAME)) goto done; } - + if (p->drag_row) { GtkTreePath *src_path = gtk_tree_row_reference_get_path(p->drag_row); - + if (src_path) { if (gtk_tree_model_get_iter((GtkTreeModel *)p->model, &iter, src_path)) gtk_tree_model_get((GtkTreeModel *)p->model, &iter, COL_POINTER_CAMEL_STORE, &sstore, COL_STRING_URI, &src_uri, -1); - + /* can't dnd onto itself or below itself - bad things happen, no point dragging to where we were either */ if (gtk_tree_path_compare(path, src_path) == 0 @@ -1169,16 +1169,16 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) gtk_tree_path_free(src_path); goto done; } - + gtk_tree_path_free(src_path); } } - + /* Check for special sources, and vfolder stuff */ if (src_uri) { CamelURL *url; char *url_path; - + /* FIXME: this is a total hack, but i think all we can do at present */ /* Check for dragging from special folders which can't be moved/copied */ url = camel_url_new(src_uri, NULL); @@ -1187,9 +1187,9 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) /* don't allow moving any of the the local special folders */ if (sstore == local && is_special_local_folder (url_path)) { GdkAtom xfolder; - + camel_url_free (url); - + /* TODO: not sure if this is legal, but it works, force copy for special local folders */ context->suggested_action = GDK_ACTION_COPY; xfolder = drop_atoms[DND_DROP_TYPE_FOLDER]; @@ -1198,19 +1198,19 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) atom = xfolder; goto done; } - + targets = targets->next; } - + goto done; } - + /* don't allow copying/moving of the UNMATCHED vfolder */ if (!strcmp (url->protocol, "vfolder") && !strcmp (url_path, CAMEL_UNMATCHED_NAME)) { camel_url_free (url); goto done; } - + /* don't allow copying/moving of any vTrash/vJunk folder nor maildir 'inbox' */ if (strcmp(url_path, CAMEL_VTRASH_NAME) == 0 || strcmp(url_path, CAMEL_VJUNK_NAME) == 0 @@ -1221,7 +1221,7 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) } } camel_url_free(url); - + /* Search Folders can only be dropped into other Search Folders */ if (strncmp(src_uri, "vfolder:", 8) == 0) { /* TODO: not sure if this is legal, but it works, force move only for vfolders */ @@ -1236,11 +1236,11 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) atom = xfolder; goto done; } - + targets = targets->next; } } - + goto done; } } @@ -1250,7 +1250,7 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) goto done; /* Now we either have a store or a normal folder */ - + if (is_store) { GdkAtom xfolder; @@ -1260,12 +1260,12 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) atom = xfolder; goto done; } - + targets = targets->next; } } else { int i; - + while (targets != NULL) { for (i = 0; i < NUM_DROP_TYPES; i++) { if (targets->data == (gpointer) drop_atoms[i]) { @@ -1273,16 +1273,16 @@ emft_drop_target(EMFolderTree *emft, GdkDragContext *context, GtkTreePath *path) goto done; } } - + targets = targets->next; } } - + done: - + g_free (full_name); g_free (uri); - + return atom; } @@ -1294,28 +1294,28 @@ tree_drag_drop (GtkWidget *widget, GdkDragContext *context, int x, int y, guint int cell_x, cell_y; GtkTreePath *path; GdkAtom target; - + if (priv->autoscroll_id != 0) { g_source_remove (priv->autoscroll_id); priv->autoscroll_id = 0; } - + if (priv->autoexpand_id != 0) { gtk_tree_row_reference_free (priv->autoexpand_row); priv->autoexpand_row = NULL; - + g_source_remove (priv->autoexpand_id); priv->autoexpand_id = 0; } - + if (!gtk_tree_view_get_path_at_pos (priv->treeview, x, y, &path, &column, &cell_x, &cell_y)) return FALSE; - + target = emft_drop_target(emft, context, path); gtk_tree_path_free (path); if (target == GDK_NONE) return FALSE; - + return TRUE; } @@ -1323,7 +1323,7 @@ static void tree_drag_end (GtkWidget *widget, GdkDragContext *context, EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; - + if (priv->drag_row) { gtk_tree_row_reference_free (priv->drag_row); priv->drag_row = NULL; @@ -1336,20 +1336,20 @@ static void tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; - + if (priv->autoscroll_id != 0) { g_source_remove (priv->autoscroll_id); priv->autoscroll_id = 0; } - + if (priv->autoexpand_id != 0) { gtk_tree_row_reference_free (priv->autoexpand_row); priv->autoexpand_row = NULL; - + g_source_remove (priv->autoexpand_id); priv->autoexpand_id = 0; } - + gtk_tree_view_set_drag_dest_row(emft->priv->treeview, NULL, GTK_TREE_VIEW_DROP_BEFORE); } @@ -1365,29 +1365,29 @@ tree_autoscroll (EMFolderTree *emft) GdkWindow *window; int offset, y; float value; - + /* get the y pointer position relative to the treeview */ window = gtk_tree_view_get_bin_window (priv->treeview); gdk_window_get_pointer (window, NULL, &y, NULL); - + /* rect is in coorinates relative to the scrolled window relative to the treeview */ gtk_tree_view_get_visible_rect (priv->treeview, &rect); - + /* move y into the same coordinate system as rect */ y += rect.y; - + /* see if we are near the top edge */ if ((offset = y - (rect.y + 2 * SCROLL_EDGE_SIZE)) > 0) { /* see if we are near the bottom edge */ if ((offset = y - (rect.y + rect.height - 2 * SCROLL_EDGE_SIZE)) < 0) return TRUE; } - + vadjustment = gtk_tree_view_get_vadjustment (priv->treeview); - + value = CLAMP (vadjustment->value + offset, 0.0, vadjustment->upper - vadjustment->page_size); gtk_adjustment_set_value (vadjustment, value); - + return TRUE; } @@ -1396,11 +1396,11 @@ tree_autoexpand (EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; GtkTreePath *path; - + path = gtk_tree_row_reference_get_path (priv->autoexpand_row); gtk_tree_view_expand_row (priv->treeview, path, FALSE); gtk_tree_path_free (path); - + return TRUE; } @@ -1415,19 +1415,19 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin GtkTreeIter iter; GdkAtom target; int i; - + if (!gtk_tree_view_get_dest_row_at_pos(priv->treeview, x, y, &path, &pos)) return FALSE; - + if (priv->autoscroll_id == 0) priv->autoscroll_id = g_timeout_add (150, (GSourceFunc) tree_autoscroll, emft); - + gtk_tree_model_get_iter (model, &iter, path); - + if (gtk_tree_model_iter_has_child (model, &iter) && !gtk_tree_view_row_expanded (priv->treeview, path)) { if (priv->autoexpand_id != 0) { GtkTreePath *autoexpand_path; - + autoexpand_path = gtk_tree_row_reference_get_path (priv->autoexpand_row); if (gtk_tree_path_compare (autoexpand_path, path) != 0) { /* row changed, restart timer */ @@ -1436,7 +1436,7 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin g_source_remove (priv->autoexpand_id); priv->autoexpand_id = g_timeout_add (600, (GSourceFunc) tree_autoexpand, emft); } - + gtk_tree_path_free (autoexpand_path); } else { priv->autoexpand_id = g_timeout_add (600, (GSourceFunc) tree_autoexpand, emft); @@ -1445,7 +1445,7 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin } else if (priv->autoexpand_id != 0) { gtk_tree_row_reference_free (priv->autoexpand_row); priv->autoexpand_row = NULL; - + g_source_remove (priv->autoexpand_id); priv->autoexpand_id = 0; } @@ -1473,9 +1473,9 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin } gtk_tree_path_free(path); - + gdk_drag_status(context, action, time); - + return action != 0; } @@ -1485,14 +1485,14 @@ em_folder_tree_enable_drag_and_drop (EMFolderTree *emft) struct _EMFolderTreePrivate *priv; static int setup = 0; int i; - + g_return_if_fail (EM_IS_FOLDER_TREE (emft)); - + priv = emft->priv; if (!setup) { for (i=0; i<NUM_DRAG_TYPES; i++) drag_atoms[i] = gdk_atom_intern(drag_types[i].target, FALSE); - + for (i=0; i<NUM_DROP_TYPES; i++) drop_atoms[i] = gdk_atom_intern(drop_types[i].target, FALSE); @@ -1501,7 +1501,7 @@ em_folder_tree_enable_drag_and_drop (EMFolderTree *emft) gtk_drag_source_set((GtkWidget *)priv->treeview, GDK_BUTTON1_MASK, drag_types, NUM_DRAG_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK); gtk_drag_dest_set((GtkWidget *)priv->treeview, GTK_DEST_DEFAULT_ALL, drop_types, NUM_DROP_TYPES, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK); - + g_signal_connect (priv->treeview, "drag-begin", G_CALLBACK (tree_drag_begin), emft); g_signal_connect (priv->treeview, "drag-data-delete", G_CALLBACK (tree_drag_data_delete), emft); g_signal_connect (priv->treeview, "drag-data-get", G_CALLBACK (tree_drag_data_get), emft); @@ -1516,7 +1516,7 @@ void em_folder_tree_set_multiselect (EMFolderTree *tree, gboolean mode) { GtkTreeSelection *sel = gtk_tree_view_get_selection ((GtkTreeView *) tree->priv->treeview); - + tree->priv->do_multiselect = mode; gtk_tree_selection_set_mode (sel, mode ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE); } @@ -1551,14 +1551,14 @@ em_folder_tree_get_selected_uris (EMFolderTree *emft) if (gtk_tree_model_get_iter(model, &iter, path)) { char *uri; - + gtk_tree_model_get(model, &iter, COL_STRING_URI, &uri, -1); list = g_list_prepend (list, uri); } gtk_tree_path_free(path); } g_list_free(rows); - + return g_list_reverse (list); } @@ -1567,7 +1567,7 @@ get_selected_uris_path_iterate (GtkTreeModel *model, GtkTreePath *treepath, GtkT { GList **list = (GList **) data; char *full_name; - + gtk_tree_model_get (model, iter, COL_STRING_FULL_NAME, &full_name, -1); *list = g_list_append (*list, full_name); } @@ -1577,9 +1577,9 @@ em_folder_tree_get_selected_paths (EMFolderTree *emft) { GtkTreeSelection *selection = gtk_tree_view_get_selection (emft->priv->treeview); GList *list = NULL; - + gtk_tree_selection_selected_foreach (selection, get_selected_uris_path_iterate, &list); - + return list; } @@ -1626,7 +1626,7 @@ em_folder_tree_set_selected_list (EMFolderTree *emft, GList *list, gboolean expa const char *path; char *expand_key, *end; EAccount *account; - + if (((CamelService *)u->store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) path = url->fragment; else @@ -1671,16 +1671,16 @@ static void dump_fi (CamelFolderInfo *fi, int depth) { int i; - + while (fi != NULL) { for (i = 0; i < depth; i++) fputs (" ", stdout); - + printf ("path='%s'; full_name='%s'\n", fi->path, fi->full_name); - + if (fi->child) dump_fi (fi->child, depth + 1); - + fi = fi->sibling; } } @@ -1688,14 +1688,14 @@ dump_fi (CamelFolderInfo *fi, int depth) struct _EMFolderTreeGetFolderInfo { struct _mail_msg msg; - + /* input data */ GtkTreeRowReference *root; EMFolderTree *emft; CamelStore *store; guint32 flags; char *top; - + /* output data */ CamelFolderInfo *fi; }; @@ -1717,7 +1717,7 @@ emft_get_folder_info__get (struct _mail_msg *mm) { struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *) mm; guint32 flags = m->flags | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; - + m->fi = camel_store_get_folder_info (m->store, m->top, flags, &mm->ex); } @@ -1732,15 +1732,15 @@ emft_get_folder_info__got (struct _mail_msg *mm) GtkTreeStore *model; GtkTreePath *path; gboolean is_store; - + /* check that we haven't been destroyed */ if (priv->treeview == NULL) return; - + /* check that our parent folder hasn't been deleted/unsubscribed */ if (!gtk_tree_row_reference_valid (m->root)) return; - + if (!(si = g_hash_table_lookup (priv->model->store_hash, m->store))) { /* store has been removed in the interim - do nothing */ return; @@ -1760,7 +1760,7 @@ emft_get_folder_info__got (struct _mail_msg *mm) } gtk_tree_path_free (path); - + /* make sure we still need to load the tree subfolders... */ gtk_tree_model_get ((GtkTreeModel *) model, &root, COL_BOOL_IS_STORE, &is_store, @@ -1768,7 +1768,7 @@ emft_get_folder_info__got (struct _mail_msg *mm) /* get the first child (which will be a dummy node) */ gtk_tree_model_iter_children ((GtkTreeModel *) model, &iter, &root); - + /* FIXME: camel's IMAP code is totally on crack here, @top's * folder info should be @fi and fi->child should be what we * want to fill our tree with... *sigh* */ @@ -1777,11 +1777,11 @@ emft_get_folder_info__got (struct _mail_msg *mm) fi = m->fi->next; } else fi = m->fi; - + if (fi == NULL) { /* no children afterall... remove the "Loading..." placeholder node */ emft_update_model_expanded_state (priv, &root, FALSE); - + if (is_store) { path = gtk_tree_model_get_path ((GtkTreeModel *) model, &root); gtk_tree_view_collapse_row (priv->treeview, path); @@ -1793,15 +1793,15 @@ emft_get_folder_info__got (struct _mail_msg *mm) } } else { int fully_loaded = (m->flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) ? TRUE : FALSE; - + do { em_folder_tree_model_set_folder_info (priv->model, &iter, si, fi, fully_loaded); - + if ((fi = fi->next) != NULL) gtk_tree_store_append (model, &iter, &root); } while (fi != NULL); } - + gtk_tree_store_set (model, &root, COL_BOOL_LOAD_SUBDIRS, FALSE, -1); emft_queue_save_state (m->emft); } @@ -1810,9 +1810,9 @@ static void emft_get_folder_info__free (struct _mail_msg *mm) { struct _EMFolderTreeGetFolderInfo *m = (struct _EMFolderTreeGetFolderInfo *) mm; - + camel_store_free_folder_info (m->store, m->fi); - + gtk_tree_row_reference_free (m->root); g_object_unref(m->emft); camel_object_unref (m->store); @@ -1835,13 +1835,13 @@ emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter EAccount *account; char *full_name; char *key; - + gtk_tree_model_get ((GtkTreeModel *) priv->model, iter, COL_STRING_FULL_NAME, &full_name, COL_POINTER_CAMEL_STORE, &store, COL_BOOL_IS_STORE, &is_store, -1); - + si = g_hash_table_lookup (priv->model->store_hash, store); if ((account = mail_config_get_account_by_name (si->display_name))) { key = g_strdup_printf ("%s/%s", account->uid, full_name ? full_name : ""); @@ -1852,7 +1852,7 @@ emft_update_model_expanded_state (struct _EMFolderTreePrivate *priv, GtkTreeIter /* local store */ key = g_strdup_printf ("local/%s", full_name ? full_name : ""); } - + em_folder_tree_model_set_expanded (priv->model, key, expanded); g_free (full_name); g_free (key); @@ -1865,7 +1865,7 @@ emft_model_row_changed (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *ite GtkTreeIter child_iter = *iter; g_signal_handlers_block_by_func (model, emft_model_row_changed, emft); - + /* Folders are displayed with a bold weight to indicate that they contain unread messages. We signal that parent rows have changed here to update them. */ @@ -1878,7 +1878,7 @@ emft_model_row_changed (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *ite gtk_tree_path_free (parent_path); child_iter = parent_iter; } - + g_signal_handlers_unblock_by_func (model, emft_model_row_changed, emft); } @@ -1891,17 +1891,17 @@ emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *t CamelStore *store; char *full_name; gboolean load; - + model = gtk_tree_view_get_model (treeview); - + gtk_tree_model_get (model, root, COL_STRING_FULL_NAME, &full_name, COL_POINTER_CAMEL_STORE, &store, COL_BOOL_LOAD_SUBDIRS, &load, -1); - + emft_update_model_expanded_state (priv, root, TRUE); - + if (!load) { emft_queue_save_state (emft); g_free (full_name); @@ -1909,7 +1909,7 @@ emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *t } gtk_tree_store_set((GtkTreeStore *)model, root, COL_BOOL_LOAD_SUBDIRS, FALSE, -1); - + m = mail_msg_new (&get_folder_info_op, NULL, sizeof (struct _EMFolderTreeGetFolderInfo)); m->root = gtk_tree_row_reference_new (model, tree_path); camel_object_ref (store); @@ -1918,7 +1918,7 @@ emft_tree_row_expanded (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePath *t g_object_ref(emft); m->top = full_name; m->flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST; - + e_thread_put (mail_thread_new, (EMsg *) m); } @@ -1928,17 +1928,17 @@ emft_tree_test_collapse_row (GtkTreeView *treeview, GtkTreeIter *root, GtkTreePa GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter cursor; - + selection = gtk_tree_view_get_selection (treeview); if (gtk_tree_selection_get_selected (selection, &model, &cursor)) { /* select the collapsed node IFF it is a parent of the currently selected folder */ if (gtk_tree_store_is_ancestor ((GtkTreeStore *) model, root, &cursor)) gtk_tree_view_set_cursor (treeview, tree_path, NULL, FALSE); } - + emft_update_model_expanded_state (emft->priv, root, FALSE); emft_queue_save_state (emft); - + return FALSE; } @@ -1950,18 +1950,18 @@ emft_tree_row_activated (GtkTreeView *treeview, GtkTreePath *tree_path, GtkTreeV char *full_name, *uri; GtkTreeIter iter; guint32 flags; - + if (!emft_select_func(NULL, model, tree_path, FALSE, emft)) return; - + if (!gtk_tree_model_get_iter (model, &iter, tree_path)) return; - + gtk_tree_model_get (model, &iter, COL_STRING_FULL_NAME, &full_name, COL_STRING_URI, &uri, COL_UINT_FLAGS, &flags, -1); emft_clear_selected_list(emft); - + g_signal_emit (emft, signals[FOLDER_SELECTED], 0, full_name, uri, flags); g_signal_emit (emft, signals[FOLDER_ACTIVATED], 0, full_name, uri); @@ -2020,7 +2020,7 @@ static void selfunc (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { struct _emft_selection_data *dat = (struct _emft_selection_data *) data; - + dat->model = model; if (!dat->set) *(dat->iter) = *iter; @@ -2031,7 +2031,7 @@ static gboolean emft_selection_get_selected (GtkTreeSelection *selection, GtkTreeModel **model, GtkTreeIter *iter) { struct _emft_selection_data dat = { NULL, iter, FALSE }; - + if (gtk_tree_selection_get_mode (selection) == GTK_SELECTION_MULTIPLE) { gtk_tree_selection_selected_foreach (selection, selfunc, &dat); if (model) @@ -2046,7 +2046,7 @@ static void emft_popup_delete_folder (EPopup *ep, EPopupItem *pitem, void *data) { EMFolderTree *emft = data; - CamelFolder *folder; + CamelFolder *folder; if ((folder = em_folder_tree_get_selected_folder (emft)) != NULL) { em_folder_utils_delete_folder(folder); @@ -2095,11 +2095,11 @@ emft_popup_properties (EPopup *ep, EPopupItem *pitem, void *data) GtkTreeModel *model; GtkTreeIter iter; char *uri; - + selection = gtk_tree_view_get_selection (priv->treeview); if (!emft_selection_get_selected (selection, &model, &iter)) return; - + gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, -1); em_folder_properties_show (NULL, NULL, uri); g_free (uri); @@ -2114,7 +2114,7 @@ static EPopupItem emft_popup_items[] = { #endif { E_POPUP_ITEM, "10.emc.00", N_("_Copy..."), emft_popup_copy, NULL, "stock_folder-copy", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT }, { E_POPUP_ITEM, "10.emc.01", N_("_Move..."), emft_popup_move, NULL, "stock_folder-move", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_DELETE }, - + { E_POPUP_BAR, "20.emc" }, /* FIXME: need to disable for nochildren folders */ { E_POPUP_ITEM, "20.emc.00", N_("_New Folder..."), emft_popup_new_folder, NULL, "folder-new", 0, EM_POPUP_FOLDER_INFERIORS }, @@ -2124,7 +2124,7 @@ static EPopupItem emft_popup_items[] = { { E_POPUP_ITEM, "20.emc.03", N_("Re_fresh"), emft_popup_refresh_folder, NULL, "view-refresh", EM_POPUP_FOLDER_NONSTATIC, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT}, { E_POPUP_ITEM, "20.emc.04", N_("Fl_ush Outbox"), emft_popup_flush_outbox, NULL, "mail-send", EM_POPUP_FOLDER_OUTBOX, 0 }, - + { E_POPUP_BAR, "80.emc" }, { E_POPUP_ITEM, "80.emc.00", N_("_Properties"), emft_popup_properties, NULL, "document-properties", 0, EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT } }; @@ -2165,7 +2165,7 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) selection = gtk_tree_view_get_selection (treeview); if (!emft_selection_get_selected (selection, &model, &iter)) return FALSE; - + gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, COL_STRING_URI, &uri, COL_STRING_FULL_NAME, &full_name, COL_BOOL_IS_STORE, &isstore, COL_UINT_FLAGS, &folder_type_flags, -1); @@ -2176,7 +2176,7 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) g_free (uri); return FALSE; } - + /* TODO: em_popup_target_folder_new? */ if (isstore) { flags |= EM_POPUP_FOLDER_STORE; @@ -2184,11 +2184,11 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) flags |= EM_POPUP_FOLDER_FOLDER; local = mail_component_peek_local_store (NULL); - + /* don't allow deletion of special local folders */ if (!(store == local && is_special_local_folder (full_name))) flags |= EM_POPUP_FOLDER_DELETE; - + /* hack for vTrash/vJunk */ if (!strcmp (full_name, CAMEL_VTRASH_NAME) || !strcmp (full_name, CAMEL_VJUNK_NAME)) info_flags |= CAMEL_FOLDER_VIRTUAL | CAMEL_FOLDER_NOINFERIORS; @@ -2206,34 +2206,34 @@ emft_popup (EMFolderTree *emft, GdkEvent *event) * This is the context menu shown on the folder tree. */ emp = em_popup_new ("org.gnome.evolution.mail.foldertree.popup"); - + /* FIXME: pass valid fi->flags here */ target = em_popup_target_new_folder (emp, uri, info_flags, flags); - + for (i = 0; i < sizeof (emft_popup_items) / sizeof (emft_popup_items[0]); i++) menus = g_slist_prepend (menus, &emft_popup_items[i]); - + if ((folder_type_flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_TRASH) menus = g_slist_prepend (menus, &trash_popup_item); e_popup_add_items ((EPopup *)emp, menus, NULL, emft_popup_free, emft); menu = e_popup_create_menu_once ((EPopup *)emp, (EPopupTarget *)target, 0); - + if (event == NULL || event->type == GDK_KEY_PRESS) { /* FIXME: menu pos function */ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time()); } else { gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time); } - + g_free (full_name); g_free (uri); return TRUE; } -static gboolean +static gboolean emft_popup_menu (GtkWidget *widget) { return emft_popup (EM_FOLDER_TREE (widget), NULL); @@ -2247,26 +2247,26 @@ emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTr /* this centralises working out when the user's done something */ emft_tree_user_event(treeview, (GdkEvent *)event, emft); - + if (event->button != 3 && !(event->button == 1 && event->type == GDK_2BUTTON_PRESS)) return FALSE; - + if (!gtk_tree_view_get_path_at_pos (treeview, (int) event->x, (int) event->y, &tree_path, NULL, NULL, NULL)) return FALSE; - + /* select/focus the row that was right-clicked or double-clicked */ selection = gtk_tree_view_get_selection (treeview); gtk_tree_selection_select_path(selection, tree_path); gtk_tree_view_set_cursor (treeview, tree_path, NULL, FALSE); - + if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { emft_tree_row_activated (treeview, tree_path, NULL, emft); gtk_tree_path_free (tree_path); return TRUE; } - + gtk_tree_path_free (tree_path); - + return emft_popup (emft, (GdkEvent *)event); } @@ -2294,10 +2294,10 @@ emft_tree_selection_changed (GtkTreeSelection *selection, EMFolderTree *emft) GtkTreeModel *model; GtkTreeIter iter; guint32 flags; - + if (!emft_selection_get_selected (selection, &model, &iter)) { em_folder_tree_model_set_selected (emft->priv->model, NULL); - g_signal_emit (emft, signals[FOLDER_SELECTED], 0, NULL, NULL, 0); + g_signal_emit (emft, signals[FOLDER_SELECTED], 0, NULL, NULL, 0); emft_queue_save_state (emft); return; } @@ -2340,7 +2340,7 @@ em_folder_tree_select_next_path (EMFolderTree *emft, gboolean skip_read_folders) current_path = gtk_tree_model_get_path (model, &iter); - do { + do { if (gtk_tree_model_iter_has_child (model, &iter)) { gtk_tree_model_iter_children (model, &child, &iter); path = gtk_tree_model_get_path (model, &child); @@ -2370,7 +2370,7 @@ em_folder_tree_select_next_path (EMFolderTree *emft, gboolean skip_read_folders) } if (path) { - if (!gtk_tree_view_row_expanded (emft->priv->treeview, path)) + if (!gtk_tree_view_row_expanded (emft->priv->treeview, path)) gtk_tree_view_expand_to_path (emft->priv->treeview, path); gtk_tree_selection_select_path(selection, path); @@ -2380,14 +2380,14 @@ em_folder_tree_select_next_path (EMFolderTree *emft, gboolean skip_read_folders) priv->cursor_set = TRUE; } gtk_tree_view_scroll_to_cell (priv->treeview, path, NULL, TRUE, 0.5f, 0.0f); - } + } return; } -static GtkTreeIter +static GtkTreeIter get_last_child (GtkTreeModel *model, GtkTreeIter *iter) { - GtkTreeIter *child = g_new0 (GtkTreeIter, 1); + GtkTreeIter *child = g_new0 (GtkTreeIter, 1); gboolean has_child = gtk_tree_model_iter_has_child (model, iter); if (gtk_tree_model_iter_next (model, iter)) { @@ -2428,7 +2428,7 @@ em_folder_tree_select_prev_path (EMFolderTree *emft, gboolean skip_read_folders) { gtk_tree_model_get_iter_first (model, &iter); iter = get_last_child (model,&iter); - path = gtk_tree_model_get_path (model, &iter); + path = gtk_tree_model_get_path (model, &iter); } } else { gtk_tree_model_get_iter (model, &iter, path); @@ -2459,7 +2459,7 @@ em_folder_tree_select_prev_path (EMFolderTree *emft, gboolean skip_read_folders) priv->cursor_set = TRUE; } gtk_tree_view_scroll_to_cell (priv->treeview, path, NULL, TRUE, 0.5f, 0.0f); - } + } return; } @@ -2477,7 +2477,7 @@ em_folder_tree_get_selected_uri (EMFolderTree *emft) selection = gtk_tree_view_get_selection(emft->priv->treeview); if (gtk_tree_selection_get_selected(selection, &model, &iter)) gtk_tree_model_get(model, &iter, COL_STRING_URI, &uri, -1); - + return uri; } @@ -2494,7 +2494,7 @@ em_folder_tree_get_selected_path (EMFolderTree *emft) selection = gtk_tree_view_get_selection(emft->priv->treeview); if (gtk_tree_selection_get_selected(selection, &model, &iter)) gtk_tree_model_get(model, &iter, COL_STRING_FULL_NAME, &name, -1); - + return name; } @@ -2543,8 +2543,8 @@ em_folder_tree_get_selected_folder_info (EMFolderTree *emft) selection = gtk_tree_view_get_selection(emft->priv->treeview); if (gtk_tree_selection_get_selected(selection, &model, &iter)) gtk_tree_model_get (model, &iter, COL_POINTER_CAMEL_STORE, &store, - COL_STRING_FULL_NAME, &full_name, - COL_STRING_DISPLAY_NAME, &name, + COL_STRING_FULL_NAME, &full_name, + COL_STRING_DISPLAY_NAME, &name, COL_STRING_URI, &uri, -1); fi = g_new0(CamelFolderInfo, 1); @@ -2573,7 +2573,7 @@ EMFolderTreeModel * em_folder_tree_get_model (EMFolderTree *emft) { g_return_val_if_fail (EM_IS_FOLDER_TREE (emft), NULL); - + return emft->priv->model; } @@ -2593,10 +2593,10 @@ static gboolean emft_save_state (EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; - + em_folder_tree_model_save_state (priv->model); priv->save_state_id = 0; - + return FALSE; } @@ -2605,9 +2605,9 @@ static void emft_queue_save_state (EMFolderTree *emft) { struct _EMFolderTreePrivate *priv = emft->priv; - + if (priv->save_state_id != 0) return; - + priv->save_state_id = g_timeout_add (1000, (GSourceFunc) emft_save_state, emft); } diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index ae7511fbe8..3fe3aa5f81 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -61,7 +61,7 @@ struct _EMFolderTree { struct _EMFolderTreeClass { GtkVBoxClass parent_class; - + /* signals */ void (* folder_activated) (EMFolderTree *emft, const char *full_name, const char *uri); void (* folder_selected) (EMFolderTree *emft, const char *full_name, const char *uri, guint32 flags); diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 3fe2587195..03d070540b 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -86,14 +86,14 @@ emfu_is_special_local_folder (const char *name) struct _EMCopyFolders { struct _mail_msg msg; - + /* input data */ CamelStore *fromstore; CamelStore *tostore; - + char *frombase; char *tobase; - + int delete; }; @@ -101,7 +101,7 @@ static char * emft_copy_folders__desc (struct _mail_msg *mm, int complete) { struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; - + return g_strdup_printf (_("Copying `%s' to `%s'"), m->frombase, m->tobase); } @@ -115,42 +115,42 @@ emft_copy_folders__copy (struct _mail_msg *mm) CamelFolderInfo *fi; const char *tmp; int fromlen; - + if (!(fi = camel_store_get_folder_info (m->fromstore, m->frombase, flags, &mm->ex))) return; - + pending = g_list_append (pending, fi); - + toname = g_string_new (""); fromname = g_string_new (""); - + tmp = strrchr (m->frombase, '/'); if (tmp == NULL) fromlen = 0; else fromlen = tmp - m->frombase + 1; - + d(printf ("top name is '%s'\n", fi->full_name)); - + while (pending) { CamelFolderInfo *info = pending->data; - + pending = g_list_remove_link (pending, pending); while (info) { CamelFolder *fromfolder, *tofolder; GPtrArray *uids; int deleted = 0; - + if (info->child) pending = g_list_append (pending, info->child); - + if (m->tobase[0]) g_string_printf (toname, "%s/%s", m->tobase, info->full_name + fromlen); else g_string_printf (toname, "%s", info->full_name + fromlen); - + d(printf ("Copying from '%s' to '%s'\n", info->full_name, toname->str)); - + /* This makes sure we create the same tree, e.g. from a nonselectable source */ /* Not sure if this is really the 'right thing', e.g. for spool stores, but it makes the ui work */ if ((info->flags & CAMEL_FOLDER_NOSELECT) == 0) { @@ -159,69 +159,69 @@ emft_copy_folders__copy (struct _mail_msg *mm) camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &mm->ex); if (camel_exception_is_set (&mm->ex)) goto exception; - + /* this folder no longer exists, unsubscribe it */ if (camel_store_supports_subscriptions (m->fromstore)) camel_store_unsubscribe_folder (m->fromstore, info->full_name, NULL); - + deleted = 1; } else { if (!(fromfolder = camel_store_get_folder (m->fromstore, info->full_name, 0, &mm->ex))) goto exception; - + if (!(tofolder = camel_store_get_folder (m->tostore, toname->str, CAMEL_STORE_FOLDER_CREATE, &mm->ex))) { camel_object_unref (fromfolder); goto exception; } - + uids = camel_folder_get_uids (fromfolder); camel_folder_transfer_messages_to (fromfolder, uids, tofolder, NULL, m->delete, &mm->ex); camel_folder_free_uids (fromfolder, uids); - + if (m->delete) camel_folder_sync(fromfolder, TRUE, NULL); - + camel_object_unref (fromfolder); camel_object_unref (tofolder); } } - + if (camel_exception_is_set (&mm->ex)) goto exception; else if (m->delete && !deleted) deleting = g_list_prepend (deleting, info); - + /* subscribe to the new folder if appropriate */ if (camel_store_supports_subscriptions (m->tostore) && !camel_store_folder_subscribed (m->tostore, toname->str)) camel_store_subscribe_folder (m->tostore, toname->str, NULL); - + info = info->next; } } - + /* delete the folders in reverse order from how we copyied them, if we are deleting any */ l = deleting; while (l) { CamelFolderInfo *info = l->data; - + d(printf ("deleting folder '%s'\n", info->full_name)); - + /* FIXME: we need to do something with the exception since otherwise the users sees a failed operation with no error message or even any warnings */ if (camel_store_supports_subscriptions (m->fromstore)) camel_store_unsubscribe_folder (m->fromstore, info->full_name, NULL); - + camel_store_delete_folder (m->fromstore, info->full_name, NULL); l = l->next; } - + exception: - + camel_store_free_folder_info (m->fromstore, fi); g_list_free (deleting); - + g_string_free (toname, TRUE); g_string_free (fromname, TRUE); } @@ -230,10 +230,10 @@ static void emft_copy_folders__free (struct _mail_msg *mm) { struct _EMCopyFolders *m = (struct _EMCopyFolders *) mm; - + camel_object_unref (m->fromstore); camel_object_unref (m->tostore); - + g_free (m->frombase); g_free (m->tobase); } @@ -284,7 +284,7 @@ emfu_copy_folder_selected (const char *uri, void *data) g_free (cfd); return; } - + camel_exception_init (&ex); if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) { @@ -292,13 +292,13 @@ emfu_copy_folder_selected (const char *uri, void *data) cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL); goto fail; } - + if (cfd->delete && fromstore == mail_component_peek_local_store (NULL) && emfu_is_special_local_folder (cfd->fi->full_name)) { e_error_run(NULL, "mail:no-rename-special-folder", cfd->fi->full_name, NULL); goto fail; } - + if (!(tostore = camel_session_get_store (session, uri, &ex))) { e_error_run(NULL, cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-copy-folder-to-notexist", cfd->fi->full_name, uri, ex.desc, NULL); @@ -314,7 +314,7 @@ emfu_copy_folder_selected (const char *uri, void *data) tobase = ""; em_folder_utils_copy_folders(fromstore, cfd->fi->full_name, tostore, tobase, cfd->delete); - + camel_url_free (url); fail: if (fromstore) @@ -361,7 +361,7 @@ void em_folder_utils_copy_folder(CamelFolderInfo *folderinfo, int delete) { struct _copy_folder_data *cfd; - + cfd = g_malloc (sizeof (*cfd)); cfd->fi = folderinfo; cfd->delete = delete; @@ -376,40 +376,40 @@ emfu_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex) { while (fi) { CamelFolder *folder; - + if (fi->child) { emfu_delete_rec (store, fi->child, ex); if (camel_exception_is_set (ex)) return; } - + d(printf ("deleting folder '%s'\n", fi->full_name)); - + /* shouldn't camel do this itself? */ if (camel_store_supports_subscriptions (store)) camel_store_unsubscribe_folder (store, fi->full_name, NULL); - + if (!(folder = camel_store_get_folder (store, fi->full_name, 0, ex))) return; - + if (!CAMEL_IS_VEE_FOLDER (folder)) { GPtrArray *uids = camel_folder_get_uids (folder); int i; - + camel_folder_freeze (folder); for (i = 0; i < uids->len; i++) camel_folder_delete_message (folder, uids->pdata[i]); - + camel_folder_free_uids (folder, uids); - + camel_folder_sync (folder, TRUE, NULL); camel_folder_thaw (folder); } - + camel_store_delete_folder (store, fi->full_name, ex); if (camel_exception_is_set (ex)) return; - + fi = fi->next; } } @@ -419,11 +419,11 @@ emfu_delete_folders (CamelStore *store, const char *full_name, CamelException *e { guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; CamelFolderInfo *fi; - + fi = camel_store_get_folder_info (store, full_name, flags, ex); if (camel_exception_is_set (ex)) return; - + emfu_delete_rec (store, fi, ex); camel_store_free_folder_info (store, fi); } @@ -434,10 +434,10 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data) CamelStore *store; CamelException ex; char *full_name; - + full_name = g_object_get_data ((GObject *) dialog, "full_name"); store = g_object_get_data ((GObject *) dialog, "store"); - + if (response == GTK_RESPONSE_OK) { camel_exception_init (&ex); emfu_delete_folders (store, full_name, &ex); @@ -447,7 +447,7 @@ emfu_delete_response (GtkWidget *dialog, int response, gpointer data) camel_exception_clear (&ex); } } - + gtk_widget_destroy (dialog); } @@ -459,7 +459,7 @@ em_folder_utils_delete_folder (CamelFolder *folder) GtkWidget *dialog; local = mail_component_peek_local_store (NULL); - + if (folder->parent_store == local && emfu_is_special_local_folder (folder->full_name)) { e_error_run(NULL, "mail:no-delete-special-folder", folder->full_name, NULL); return; @@ -495,12 +495,12 @@ em_folder_utils_rename_folder (CamelFolder *folder) "mail:no-rename-special-folder", folder->full_name, NULL); return; } - + if ((p = strrchr (folder->full_name, '/'))) base_len = (size_t) (p - folder->full_name); else base_len = 0; - + prompt = g_strdup_printf (_("Rename the \"%s\" folder to:"), folder->name); while (!done) { new_name = e_request_string (NULL, _("Rename Folder"), prompt, folder->name); @@ -515,7 +515,7 @@ em_folder_utils_rename_folder (CamelFolder *folder) CamelFolderInfo *fi; CamelException ex; char *path, *tmp; - + if (base_len > 0) { path = g_malloc (base_len + strlen (new_name) + 2); memcpy (path, folder->full_name, base_len); @@ -525,7 +525,7 @@ em_folder_utils_rename_folder (CamelFolder *folder) } else { path = g_strdup (new_name); } - + camel_exception_init (&ex); if ((fi = camel_store_get_folder_info (folder->parent_store, path, CAMEL_STORE_FOLDER_INFO_FAST, &ex)) != NULL) { camel_store_free_folder_info (folder->parent_store, fi); @@ -533,12 +533,12 @@ em_folder_utils_rename_folder (CamelFolder *folder) "mail:no-rename-folder-exists", folder->name, new_name, NULL); } else { const char *oldpath, *newpath; - + oldpath = folder->full_name; newpath = path; - + d(printf ("renaming %s to %s\n", oldpath, newpath)); - + camel_exception_clear (&ex); camel_store_rename_folder (folder->parent_store, oldpath, newpath, &ex); if (camel_exception_is_set (&ex)) { @@ -546,36 +546,36 @@ em_folder_utils_rename_folder (CamelFolder *folder) "mail:no-rename-folder", oldpath, newpath, ex.desc, NULL); camel_exception_clear (&ex); } - + done = TRUE; } - + g_free (path); } - + g_free (new_name); } } struct _EMCreateFolder { struct _mail_msg msg; - + /* input data */ CamelStore *store; char *full_name; char *parent; char *name; - + /* output data */ CamelFolderInfo *fi; - + /* callback data */ void (* done) (CamelFolderInfo *fi, void *user_data); void *user_data; }; /* Temporary Structure to hold data to pass across function */ -struct _EMCreateFolderTempData +struct _EMCreateFolderTempData { EMFolderTree * emft; EMFolderSelector * emfs; @@ -586,7 +586,7 @@ static char * emfu_create_folder__desc (struct _mail_msg *mm, int done) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + return g_strdup_printf (_("Creating folder `%s'"), m->full_name); } @@ -594,9 +594,9 @@ static void emfu_create_folder__create (struct _mail_msg *mm) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name)); - + if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &mm->ex))) { if (camel_store_supports_subscriptions (m->store)) camel_store_subscribe_folder (m->store, m->full_name, &mm->ex); @@ -607,7 +607,7 @@ static void emfu_create_folder__created (struct _mail_msg *mm) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + if (m->done) m->done (m->fi, m->user_data); } @@ -616,7 +616,7 @@ static void emfu_create_folder__free (struct _mail_msg *mm) { struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - + camel_store_free_folder_info (m->store, m->fi); camel_object_unref (m->store); g_free (m->full_name); @@ -639,7 +639,7 @@ emfu_create_folder_real (CamelStore *store, const char *full_name, void (* done) struct _EMCreateFolder *m; const char *parent; int id; - + namebuf = g_strdup (full_name); if (!(name = strrchr (namebuf, '/'))) { name = namebuf; @@ -648,7 +648,7 @@ emfu_create_folder_real (CamelStore *store, const char *full_name, void (* done) *name++ = '\0'; parent = namebuf; } - + m = mail_msg_new (&create_folder_op, NULL, sizeof (struct _EMCreateFolder)); camel_object_ref (store); m->store = store; @@ -657,12 +657,12 @@ emfu_create_folder_real (CamelStore *store, const char *full_name, void (* done) m->name = g_strdup (name); m->user_data = user_data; m->done = done; - + g_free (namebuf); - + id = m->msg.seq; e_thread_put (mail_thread_new, (EMsg *) m); - + return id; } @@ -672,11 +672,11 @@ new_folder_created_cb (CamelFolderInfo *fi, void *user_data) struct _EMCreateFolderTempData *emcftd=user_data; if (fi){ gtk_widget_destroy ((GtkWidget *) emcftd->emfs); - + /* Exapnding newly created folder */ if (emcftd->emft) - em_folder_tree_set_selected ((EMFolderTree *) emcftd->emft, emcftd->uri, GPOINTER_TO_INT(g_object_get_data ((GObject *)emcftd->emft, "select")) ? FALSE : TRUE); - } + em_folder_tree_set_selected ((EMFolderTree *) emcftd->emft, emcftd->uri, GPOINTER_TO_INT(g_object_get_data ((GObject *)emcftd->emft, "select")) ? FALSE : TRUE); + } g_object_unref (emcftd->emfs); g_free (emcftd->uri); g_free (emcftd); @@ -690,7 +690,7 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, int response, gpointer d CamelException ex; CamelStore *store; struct _EMCreateFolderTempData *emcftd; - + if (response != GTK_RESPONSE_OK) { gtk_widget_destroy ((GtkWidget *) emfs); return; @@ -728,11 +728,11 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, int response, gpointer d emcftd->emfs = emfs; emcftd->uri = g_strdup (uri); emcftd->emft = (EMFolderTree *) data; - + g_object_ref (emfs); emfu_create_folder_real (si->store, path, new_folder_created_cb, emcftd); } - + camel_object_unref (store); camel_exception_clear (&ex); } @@ -746,7 +746,7 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft) model = mail_component_peek_tree_model (mail_component_peek ()); folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); - + dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); if (folderinfo != NULL) em_folder_selector_set_selected ((EMFolderSelector *) dialog, folderinfo->uri); diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 5ec86facb3..0d7eed1236 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -86,7 +86,7 @@ #include "e-util/e-dialog-utils.h" #include "e-util/e-icon-factory.h" #include "e-util/e-print.h" -#include "e-util/e-profile-event.h" +#include "e-util/e-profile-event.h" #include "e-util/e-util-private.h" #include "filter/filter-rule.h" @@ -272,14 +272,14 @@ emfv_init(GObject *o) EMFolderView *emfv = (EMFolderView *)o; struct _EMFolderViewPrivate *p; extern CamelSession *session; - + gtk_box_set_homogeneous (GTK_BOX (emfv), FALSE); p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate)); emfv->statusbar_active = TRUE; emfv->list_active = FALSE; - + emfv->ui_files = g_slist_append(NULL, g_build_filename (EVOLUTION_UIDIR, "evolution-mail-message.xml", @@ -400,20 +400,20 @@ static void emfv_class_init(GObjectClass *klass) { klass->finalize = emfv_finalise; - + ((GtkObjectClass *) klass)->destroy = emfv_destroy; - + ((GtkWidgetClass *) klass)->popup_menu = emfv_popup_menu; - + ((EMFolderViewClass *) klass)->update_message_style = TRUE; - + ((EMFolderViewClass *)klass)->set_folder = emfv_set_folder; ((EMFolderViewClass *)klass)->set_folder_uri = emfv_set_folder_uri; ((EMFolderViewClass *)klass)->set_message = emfv_set_message; ((EMFolderViewClass *)klass)->activate = emfv_activate; ((EMFolderViewClass *)klass)->on_url = emfv_on_url; - + signals[EMFV_ON_URL] = g_signal_new ("on-url", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, @@ -480,7 +480,7 @@ em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set) if (emfv->folder == NULL) return 0; - + uids = message_list_get_selected(emfv->list); camel_folder_freeze(emfv->folder); @@ -489,7 +489,7 @@ em_folder_view_mark_selected(EMFolderView *emfv, guint32 mask, guint32 set) message_list_free_uids(emfv->list, uids); camel_folder_thaw(emfv->folder); - + return i; } @@ -499,7 +499,7 @@ em_folder_view_open_selected(EMFolderView *emfv) { GPtrArray *uids, *views; int i = 0; - + uids = message_list_get_selected(emfv->list); if (uids->len >= 10) { @@ -589,10 +589,10 @@ emfv_setup_view_instance(EMFolderView *emfv) struct _EMFolderViewPrivate *p = emfv->priv; gboolean outgoing, show_wide; char *id; - + g_return_if_fail (emfv->folder); g_return_if_fail (emfv->folder_uri); - + if (collection == NULL) { ETableSpecification *spec; GalViewFactory *factory; @@ -602,9 +602,9 @@ emfv_setup_view_instance(EMFolderView *emfv) char *etspecfile; collection = gal_view_collection_new (); - + gal_view_collection_set_title (collection, _("Mail")); - + evolution_dir = mail_component_peek_base_directory (mail_component_peek ()); galviewsmaildir = g_build_filename (EVOLUTION_GALVIEWSDIR, "mail", @@ -613,7 +613,7 @@ emfv_setup_view_instance(EMFolderView *emfv) gal_view_collection_set_storage_directories (collection, galviewsmaildir, dir); g_free (dir); g_free (galviewsmaildir); - + spec = e_table_specification_new (); etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, "message-list.etspec", @@ -622,12 +622,12 @@ emfv_setup_view_instance(EMFolderView *emfv) g_error ("Unable to load ETable specification file " "for mail"); g_free (etspecfile); - + factory = gal_view_factory_etable_new (spec); g_object_unref (spec); gal_view_collection_add_factory (collection, factory); g_object_unref (factory); - + gal_view_collection_load (collection); } @@ -640,18 +640,18 @@ emfv_setup_view_instance(EMFolderView *emfv) g_object_unref(p->view_menus); p->view_menus = NULL; } - + /* TODO: should this go through mail-config api? */ id = mail_config_folder_to_safe_url (emfv->folder); p->view_instance = gal_view_instance_new (collection, id); - + show_wide = em_folder_browser_get_wide ((EMFolderBrowser *) emfv); if (show_wide) { char *safe_id, *filename; - + /* Force to use the wide view */ g_free (p->view_instance->custom_filename); - g_free (p->view_instance->current_view_filename); + g_free (p->view_instance->current_view_filename); safe_id = g_strdup (id); e_filename_make_safe (safe_id); filename = g_strdup_printf ("custom_wide_view-%s.xml", safe_id); @@ -662,11 +662,11 @@ emfv_setup_view_instance(EMFolderView *emfv) g_free (safe_id); } g_free (id); - + outgoing = em_utils_folder_is_drafts (emfv->folder, emfv->folder_uri) || em_utils_folder_is_sent (emfv->folder, emfv->folder_uri) || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri); - + if (outgoing) { if (show_wide) gal_view_instance_set_default_view(p->view_instance, "Wide_View_Sent"); @@ -675,9 +675,9 @@ emfv_setup_view_instance(EMFolderView *emfv) } else if (show_wide) { gal_view_instance_set_default_view(p->view_instance, "Wide_View_Normal"); } - + gal_view_instance_load(p->view_instance); - + if (!gal_view_instance_exists(p->view_instance)) { struct stat st; char *path; @@ -688,7 +688,7 @@ emfv_setup_view_instance(EMFolderView *emfv) ETableState *state; GalView *view; char *etspecfile; - + spec = e_table_specification_new (); etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, "message-list.etspec", @@ -697,22 +697,22 @@ emfv_setup_view_instance(EMFolderView *emfv) g_free (etspecfile); view = gal_view_etable_new (spec, ""); g_object_unref (spec); - + state = e_table_state_new (); e_table_state_load_from_file (state, path); gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state); g_object_unref (state); - + gal_view_instance_set_custom_view(p->view_instance, view); g_object_unref (view); } - + g_free (path); } g_signal_connect(p->view_instance, "display_view", G_CALLBACK(emfv_list_display_view), emfv); emfv_list_display_view(p->view_instance, gal_view_instance_get_current_view(p->view_instance), emfv); - + if (emfv->list_active && emfv->uic) { p->view_menus = gal_view_menus_new(p->view_instance); gal_view_menus_apply(p->view_menus, emfv->uic, NULL); @@ -733,20 +733,20 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) && (em_utils_folder_is_drafts(folder, uri) || em_utils_folder_is_sent(folder, uri) || em_utils_folder_is_outbox(folder, uri))); - + if (folder == emfv->folder) return; if (emfv->priv->selected_id) g_source_remove(emfv->priv->selected_id); - + if (emfv->preview) em_format_format ((EMFormat *) emfv->preview, NULL, NULL, NULL); - + message_list_set_folder(emfv->list, folder, uri, isout); g_free(emfv->folder_uri); emfv->folder_uri = uri ? g_strdup(uri):NULL; - + if (emfv->folder) { emfv->hide_deleted = emfv->list->hidedeleted; /* <- a bit nasty but makes it track the display better */ mail_sync_folder (emfv->folder, NULL, NULL); @@ -755,12 +755,12 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) emfv->folder = folder; if (folder) { - /* We need to set this up to get the right view options for the message-list, + /* We need to set this up to get the right view options for the message-list, * even if we're not showing it */ emfv_setup_view_instance(emfv); camel_object_ref(folder); } - + emfv_enable_menus(emfv); /* TODO: should probably be called after all processing, not just this class's impl */ @@ -771,7 +771,7 @@ static void emfv_got_folder(char *uri, CamelFolder *folder, void *data) { EMFolderView *emfv = data; - + em_folder_view_set_folder(emfv, folder, uri); } @@ -837,7 +837,7 @@ emfv_popup_edit (EPopup *ep, EPopupItem *pitem, void *data) if (!em_utils_check_user_can_send_mail((GtkWidget *)emfv)) return; - + uids = message_list_get_selected(emfv->list); em_utils_edit_messages (emfv->folder, uids, FALSE); } @@ -847,7 +847,7 @@ emfv_popup_saveas(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; GPtrArray *uids; - + uids = message_list_get_selected(emfv->list); em_utils_save_messages((GtkWidget *)emfv, emfv->folder, uids); } @@ -881,7 +881,7 @@ emfv_popup_source(EPopup *ep, EPopupItem *pitem, void *data) EMFolderView *emfv = data; EMMessageBrowser *emmb; GPtrArray *uids; - + uids = message_list_get_selected(emfv->list); emmb = (EMMessageBrowser *)em_message_browser_window_new(); @@ -953,7 +953,7 @@ emfv_popup_flag_completed(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; GPtrArray *uids; - + uids = message_list_get_selected(emfv->list); em_utils_flag_for_followup_completed((GtkWidget *)emfv, emfv->folder, uids); @@ -985,7 +985,7 @@ emfv_popup_mark_unread(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, 0); - + if (emfv->list->seen_id) { g_source_remove(emfv->list->seen_id); emfv->list->seen_id = 0; @@ -1011,7 +1011,7 @@ emfv_popup_mark_junk (EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; int count; - + count = em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN); @@ -1024,7 +1024,7 @@ emfv_popup_mark_nojunk (EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; int count; - + count = em_folder_view_mark_selected(emfv, CAMEL_MESSAGE_JUNK|CAMEL_MESSAGE_JUNK_LEARN, CAMEL_MESSAGE_JUNK_LEARN); @@ -1074,12 +1074,12 @@ emfv_delete_msg_response (GtkWidget *dialog, int response, gpointer data) _("Mail Deletion Failed"), _("You do not have sufficient permissions to delete this mail.")); gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); - } else + } else e_error_run (NULL, "mail:no-delete-permission", "", ""); count = -1; break; - } else + } else camel_folder_set_message_flags(emfv->folder, uids->pdata[count], CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_DELETED ); } @@ -1144,14 +1144,14 @@ static void emfv_popup_move_cb(const char *uri, void *data) { struct _move_data *d = data; - + if (uri) { g_free (default_xfer_messages_uri); default_xfer_messages_uri = g_strdup (uri); mail_transfer_messages(d->emfv->folder, d->uids, d->delete, uri, 0, NULL, NULL); } else em_utils_uids_free(d->uids); - + g_object_unref(d->emfv); g_free(d); } @@ -1161,13 +1161,13 @@ emfv_popup_move(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; struct _move_data *d; - + d = g_malloc(sizeof(*d)); d->emfv = emfv; g_object_ref(emfv); d->uids = message_list_get_selected(emfv->list); d->delete = TRUE; - + em_select_folder ((GtkWindow *) emfv, _("Select folder"), _("_Move"), default_xfer_messages_uri, NULL, emfv_popup_move_cb, d); } @@ -1176,13 +1176,13 @@ emfv_popup_copy(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; struct _move_data *d; - + d = g_malloc(sizeof(*d)); d->emfv = emfv; g_object_ref(emfv); d->uids = message_list_get_selected(emfv->list); d->delete = FALSE; - + em_select_folder ((GtkWindow *) emfv, _("Select folder"), _("C_opy"), default_xfer_messages_uri, NULL, emfv_popup_move_cb, d); } @@ -1309,7 +1309,7 @@ static EPopupItem emfv_popup_items[] = { { E_POPUP_ITEM, "70.emfv.07", N_("Fla_g Completed"), emfv_popup_flag_completed, NULL, "stock_mail-flag-for-followup-done", EM_POPUP_SELECT_FLAG_COMPLETED|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_ITEM, "70.emfv.08", N_("Cl_ear Flag"), emfv_popup_flag_clear, NULL, NULL, EM_POPUP_SELECT_FLAG_CLEAR|EM_FOLDER_VIEW_SELECT_LISTONLY }, - + { E_POPUP_BAR, "90.filter", NULL, NULL, NULL, NULL }, { E_POPUP_SUBMENU, "90.filter.00", N_("Crea_te Rule From Message"), NULL, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_ITEM, "90.filter.00/00.00", N_("Search Folder from _Subject"), emfv_popup_vfolder_subject, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, @@ -1317,7 +1317,7 @@ static EPopupItem emfv_popup_items[] = { { E_POPUP_ITEM, "90.filter.00/00.02", N_("Search Folder from _Recipients"), emfv_popup_vfolder_recipients, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_ITEM, "90.filter.00/00.03", N_("Search Folder from Mailing _List"), emfv_popup_vfolder_mlist, NULL, NULL, EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST|EM_FOLDER_VIEW_SELECT_LISTONLY }, - + { E_POPUP_BAR, "90.filter.00/10", NULL, NULL, NULL, NULL }, { E_POPUP_ITEM, "90.filter.00/10.00", N_("Filter on Sub_ject"), emfv_popup_filter_subject, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, { E_POPUP_ITEM, "90.filter.00/10.01", N_("Filter on Sen_der"), emfv_popup_filter_sender, NULL, NULL, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY }, @@ -1346,7 +1346,7 @@ emfv_popup_items_free(EPopup *ep, GSList *items, void *data) { g_slist_free(items); } - + static void emfv_popup(EMFolderView *emfv, GdkEvent *event, int on_display) { @@ -1379,7 +1379,7 @@ emfv_popup(EMFolderView *emfv, GdkEvent *event, int on_display) GdkPixmap *pixmap; GdkColor colour; GdkGC *gc; - + item = g_malloc0(sizeof(*item)); item->type = E_POPUP_IMAGE; item->path = g_strdup_printf("60.label.00/00.label.%02d", i++); @@ -1391,7 +1391,7 @@ emfv_popup(EMFolderView *emfv, GdkEvent *event, int on_display) gdk_color_parse(label->colour, &colour); gdk_colormap_alloc_color(gdk_colormap_get_system(), &colour, FALSE, TRUE); - + pixmap = gdk_pixmap_new(((GtkWidget *)emfv)->window, 16, 16, -1); gc = gdk_gc_new(((GtkWidget *)emfv)->window); gdk_gc_set_foreground(gc, &colour); @@ -1459,7 +1459,7 @@ static void emfv_empty_trash(BonoboUIComponent *uid, void *data, const char *path) { EMFolderView *emfv = data; - + em_utils_empty_trash (gtk_widget_get_toplevel ((GtkWidget *) emfv)); } @@ -1515,11 +1515,11 @@ emfv_select_all_text(BonoboUIComponent *uid, void *data, const char *path) { EMFolderView *emfv = data; gboolean selected; - + gtk_html_select_all (((EMFormatHTML *)emfv->preview)->html); selected = gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active"); - bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); - + bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); + } static void @@ -1536,7 +1536,7 @@ static void emfv_mail_next_flagged(BonoboUIComponent *uid, void *data, const char *path) { EMFolderView *emfv = data; - + message_list_select(emfv->list, MESSAGE_LIST_SELECT_NEXT|MESSAGE_LIST_SELECT_WRAP, CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED); } @@ -1587,10 +1587,10 @@ emfv_message_forward_attached (BonoboUIComponent *uic, void *data, const char *p { EMFolderView *emfv = data; GPtrArray *uids; - + if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) return; - + uids = message_list_get_selected (emfv->list); em_utils_forward_attached (emfv->folder, uids, emfv->folder_uri); } @@ -1600,10 +1600,10 @@ emfv_message_forward_inline (BonoboUIComponent *uic, void *data, const char *pat { EMFolderView *emfv = data; GPtrArray *uids; - + if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) return; - + uids = message_list_get_selected (emfv->list); em_utils_forward_inline (emfv->folder, uids, emfv->folder_uri); } @@ -1613,10 +1613,10 @@ emfv_message_forward_quoted (BonoboUIComponent *uic, void *data, const char *pat { EMFolderView *emfv = data; GPtrArray *uids; - + if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) return; - + uids = message_list_get_selected (emfv->list); em_utils_forward_quoted (emfv->folder, uids, emfv->folder_uri); } @@ -1625,13 +1625,13 @@ static void emfv_message_redirect (BonoboUIComponent *uic, void *data, const char *path) { EMFolderView *emfv = data; - + if (emfv->list->cursor_uid == NULL) return; - + if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) return; - + em_utils_redirect_message_by_uid (emfv->folder, emfv->list->cursor_uid); } @@ -1639,13 +1639,13 @@ static void emfv_message_post_reply (BonoboUIComponent *uic, void *data, const char *path) { EMFolderView *emfv = data; - + if (emfv->list->cursor_uid == NULL) return; - + if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) return; - + em_utils_post_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid); } @@ -1692,10 +1692,10 @@ emfv_message_reply(EMFolderView *emfv, int mode) { char *html = NULL; gint len; - + if (emfv->list->cursor_uid == NULL) return; - + if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv)) return; @@ -1704,10 +1704,10 @@ emfv_message_reply(EMFolderView *emfv, int mode) && len && html[0] && html_contains_nonwhitespace (html, len)) { CamelMimeMessage *msg, *src; struct _camel_header_raw *header; - + src = (CamelMimeMessage *)((EMFormat *)emfv->preview)->message; msg = camel_mime_message_new(); - + /* need to strip content- headers */ header = ((CamelMimePart *)src)->headers; while (header) { @@ -1731,7 +1731,7 @@ static void emfv_message_search(BonoboUIComponent *uic, void *data, const char *path) { EMFolderView *emfv = data; - + if (!emfv->list_active) /* We are in new mail window */ em_format_html_display_search(emfv->preview); else { @@ -1795,10 +1795,10 @@ static void filter_type_got_message (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *user_data) { struct _filter_data *data = user_data; - + if (msg) filter_gui_add_from_message (msg, data->source, data->type); - + filter_data_free (data); } @@ -1806,11 +1806,11 @@ static void filter_type_uid (CamelFolder *folder, const char *uid, const char *source, int type) { struct _filter_data *data; - + data = g_malloc0 (sizeof (*data)); data->type = type; data->source = source; - + mail_get_message (folder, uid, filter_type_got_message, data, mail_thread_new); } @@ -1819,18 +1819,18 @@ filter_type_current (EMFolderView *emfv, int type) { const char *source; GPtrArray *uids; - + if (em_utils_folder_is_sent (emfv->folder, emfv->folder_uri) || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri)) source = FILTER_SOURCE_OUTGOING; else source = FILTER_SOURCE_INCOMING; - + uids = message_list_get_selected (emfv->list); - + if (uids->len == 1) filter_type_uid (emfv->folder, (char *) uids->pdata[0], source, type); - + em_utils_uids_free (uids); } @@ -1843,10 +1843,10 @@ static void vfolder_type_got_message (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *user_data) { struct _filter_data *data = user_data; - + if (msg) vfolder_gui_add_from_message (msg, data->type, data->uri); - + filter_data_free (data); } @@ -1855,9 +1855,9 @@ emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target; - CamelURL *url; + CamelURL *url; CamelInternetAddress *addr; - + url = camel_url_new(t->uri, NULL); if (url == NULL) { g_warning("cannot parse url '%s'", t->uri); @@ -1870,9 +1870,9 @@ emp_uri_popup_vfolder_sender(EPopup *ep, EPopupItem *pitem, void *data) vfolder_gui_add_from_address (addr, AUTO_FROM, emfv->folder_uri); camel_object_unref (addr); } - - camel_url_free(url); - + + camel_url_free(url); + } @@ -1881,9 +1881,9 @@ emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, void *data) { EMFolderView *emfv = data; EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target; - CamelURL *url; + CamelURL *url; CamelInternetAddress *addr; - + url = camel_url_new(t->uri, NULL); if (url == NULL) { g_warning("cannot parse url '%s'", t->uri); @@ -1897,18 +1897,18 @@ emp_uri_popup_vfolder_recipient(EPopup *ep, EPopupItem *pitem, void *data) camel_object_unref (addr); } - camel_url_free(url); + camel_url_free(url); } static void vfolder_type_uid (CamelFolder *folder, const char *uid, const char *uri, int type) { struct _filter_data *data; - + data = g_malloc0 (sizeof (*data)); data->type = type; data->uri = g_strdup (uri); - + mail_get_message (folder, uid, vfolder_type_got_message, data, mail_thread_new); } @@ -1916,12 +1916,12 @@ static void vfolder_type_current (EMFolderView *emfv, int type) { GPtrArray *uids; - + uids = message_list_get_selected (emfv->list); - + if (uids->len == 1) vfolder_type_uid (emfv->folder, (char *) uids->pdata[0], emfv->folder_uri, type); - + em_utils_uids_free (uids); } @@ -2128,7 +2128,7 @@ emfv_view_mode(BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_Even if (EM_FOLDER_VIEW_GET_CLASS (emfv)->update_message_style) { GConfClient *gconf = mail_config_get_gconf_client (); - + gconf_client_set_int (gconf, "/apps/evolution/mail/display/message_style", i, NULL); } } @@ -2197,10 +2197,10 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) bonobo_ui_component_add_listener(uic, "ViewFullHeaders", emfv_view_mode, emfv); /* bonobo_ui_component_add_listener(uic, "ViewSource", emfv_view_mode, emfv); */ em_format_set_mode((EMFormat *)emfv->preview, style); - + if (emfv->folder) bonobo_ui_component_set_prop(uic, "/commands/MessageEdit", "sensitive", "0", NULL); - + /* default charset used in mail view */ e_charset_picker_bonobo_ui_populate (uic, "/menu/View", _("Default"), emfv_charset_changed, emfv); @@ -2304,9 +2304,9 @@ em_folder_view_get_popup_target(EMFolderView *emfv, EMPopup *emp, int on_display /* See bug 352980 */ /* See bug #54770 */ - /* if (!emfv->hide_deleted) + /* if (!emfv->hide_deleted) t->target.mask &= ~EM_POPUP_SELECT_DELETE;*/ - + return t; } @@ -2314,7 +2314,7 @@ void em_folder_view_set_statusbar (EMFolderView *emfv, gboolean statusbar) { g_return_if_fail (emfv); - + emfv->statusbar_active = statusbar; if (statusbar && emfv->uic) @@ -2347,7 +2347,7 @@ static void mst_free (struct mst_t *mst) { mst->emfv->list->seen_id = 0; - + g_free (mst->uid); g_free (mst); } @@ -2358,10 +2358,10 @@ do_mark_seen (gpointer user_data) struct mst_t *mst = user_data; EMFolderView *emfv = mst->emfv; MessageList *list = emfv->list; - + if (mst->uid && list->cursor_uid && !strcmp (mst->uid, list->cursor_uid)) emfv_set_seen (emfv, mst->uid); - + return FALSE; } @@ -2371,7 +2371,7 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM EMFolderView *emfv = data; EMEvent *eme; EMEventTargetMessage *target; - + if (emfv->preview == NULL) { emfv->priv->nomarkseen = FALSE; emfv_enable_menus(emfv); @@ -2387,7 +2387,7 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM /** @Event: message.reading * @Title: Viewing a message * @Target: EMEventTargetMessage - * + * * message.reading is emitted whenever a user views a message. */ /* TODO: do we emit a message.reading with no message when we're looking at nothing or don't care? */ @@ -2399,15 +2399,15 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM if (emfv->list->seen_id) g_source_remove(emfv->list->seen_id); - + if (msg && emfv->mark_seen && !emfv->priv->nomarkseen) { if (emfv->mark_seen_timeout > 0) { struct mst_t *mst; - + mst = g_new (struct mst_t, 1); mst->emfv = emfv; mst->uid = g_strdup (uid); - + emfv->list->seen_id = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, emfv->mark_seen_timeout, (GSourceFunc)do_mark_seen, mst, (GDestroyNotify)mst_free); } else { @@ -2425,7 +2425,7 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); camel_exception_clear(ex); } - + emfv->priv->nomarkseen = FALSE; emfv_enable_menus(emfv); g_object_unref (emfv); @@ -2440,11 +2440,11 @@ emfv_spin(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) if (!strcmp(eb->classid, "spinner")) { GtkWidget *box, *label; gchar *msg = g_strdup_printf("<b>%s</b>", _("Retrieving Message...")); - + label = gtk_label_new (NULL); gtk_label_set_markup ((GtkLabel *)label, msg); box = gtk_hbox_new (FALSE, 0); - g_free (msg); + g_free (msg); ep = e_spinner_new (); e_spinner_set_size ((ESpinner *)ep, GTK_ICON_SIZE_SMALL_TOOLBAR); @@ -2455,7 +2455,7 @@ emfv_spin(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) gtk_container_add ((GtkContainer *)eb, box); gtk_widget_show_all ((GtkWidget *)eb); - + g_signal_handlers_disconnect_by_func(efh, emfv_spin, NULL); } @@ -2595,7 +2595,7 @@ emfv_list_key_press(ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, default: return FALSE; } - + return TRUE; } @@ -2605,14 +2605,14 @@ emfv_popup_menu (GtkWidget *widget) gboolean ret = FALSE; EMFolderView *emfv = (EMFolderView *)widget; - /* Try to bring up menu for preview html object. - Currently we cannot directly connect to html's "popup_menu" signal + /* Try to bring up menu for preview html object. + Currently we cannot directly connect to html's "popup_menu" signal since it doesn't work. */ - + if (GTK_WIDGET_HAS_FOCUS (emfv->preview->formathtml.html)) ret = em_format_html_display_popup_menu (emfv->preview); - + if (!ret) emfv_popup (emfv, NULL, FALSE); @@ -2632,7 +2632,7 @@ emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderVie { if (!strncmp (uri, "##", 2)) return; - + if (!g_ascii_strncasecmp (uri, "mailto:", 7)) { em_utils_compose_new_message_with_mailto (uri, emfv->folder_uri); } else if (*uri == '#') { @@ -2643,9 +2643,9 @@ emfv_format_link_clicked(EMFormatHTMLDisplay *efhd, const char *uri, EMFolderVie /* ignore */ } else { GError *err = NULL; - + gnome_url_show (uri, &err); - + if (err) { g_warning ("gnome_url_show: %s", err->message); g_error_free (err); @@ -2818,13 +2818,13 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold char *tkey; g_return_if_fail (gconf_entry_get_key (entry) != NULL); - + if (!(value = gconf_entry_get_value (entry))) return; - + tkey = strrchr(entry->key, '/'); g_return_if_fail (tkey != NULL); - + switch(GPOINTER_TO_INT(g_hash_table_lookup(emfv_setting_key, tkey+1))) { case EMFV_ANIMATE_IMAGES: em_format_html_display_set_animate(emfv->preview, gconf_value_get_bool (value)); @@ -2854,7 +2854,7 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold case EMFV_MESSAGE_STYLE: if (EM_FOLDER_VIEW_GET_CLASS (emfv)->update_message_style) { int style = gconf_value_get_int (value); - + if (style < EM_FORMAT_NORMAL || style > EM_FORMAT_SOURCE) style = EM_FORMAT_NORMAL; em_format_set_mode((EMFormat *)emfv->preview, style); @@ -2880,7 +2880,7 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold while (p) { EMMailerPrefsHeader *h; char *xml = (char *)p->data; - + h = em_mailer_prefs_header_from_xml(xml); if (h && h->enabled) { em_format_add_header(emf, h->name, EM_FORMAT_HEADER_BOLD); @@ -2904,45 +2904,45 @@ emfv_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, EMFold if (emf->message) em_format_redraw(emf); - break; } + break; } case EMFV_PHOTO_LOCAL: { EMFormat *emf = (EMFormat *)emfv->preview; emf->photo_local = gconf_value_get_bool (value); - break; } + break; } case EMFV_SHOW_PREVIEW: { gboolean state_gconf, state_camel; char *ret; - /* If emfv->folder hasn't been initialized, do nothing */ + /* If emfv->folder hasn't been initialized, do nothing */ if (!emfv->folder) return; - + state_gconf = gconf_value_get_bool (value); if (state_gconf == FALSE) emfv_enable_menus (emfv); - + if ((ret = camel_object_meta_get (emfv->folder, "evolution:show_preview"))) { state_camel = (ret[0] != '0'); g_free (ret); if (state_gconf == state_camel) return; } - + if (camel_object_meta_set (emfv->folder, "evolution:show_preview", state_gconf ? "1" : "0")) camel_object_state_write (emfv->folder); em_folder_browser_show_preview ((EMFolderBrowser *)emfv, state_gconf); bonobo_ui_component_set_prop (emfv->uic, "/commands/ViewPreview", "state", state_gconf ? "1" : "0", NULL); break; } - case EMFV_SHOW_DELETED: { + case EMFV_SHOW_DELETED: { gboolean state; state = gconf_value_get_bool (value); em_folder_view_set_hide_deleted (emfv, !state); /* Set the prop only if the component has already been - * activated. */ - if (emfv->uic) + * activated. */ + if (emfv->uic) bonobo_ui_component_set_prop (emfv->uic, "/commands/HideDeleted", "state", state ? "0" : "1", NULL); break; } case EMFV_THREAD_LIST: { @@ -3068,9 +3068,9 @@ emfv_on_url_cb (GObject *emitter, const char *url, EMFolderView *emfv) } else nice_url = g_strdup_printf (_("Click to open %s"), url); } - + g_signal_emit (emfv, signals[EMFV_ON_URL], 0, url, nice_url); - + g_free (nice_url); } @@ -3078,10 +3078,10 @@ static gboolean emfv_on_html_button_released_cb (GtkHTML *html, GdkEventButton *button, EMFolderView *emfv) { gboolean selected; - + selected = gtk_html_command (html, "is-selection-active"); bonobo_ui_component_set_prop(emfv->uic, "/commands/EditCopy", "sensitive", selected?"1":"0", NULL); - + return FALSE; } - + diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h index 75416acd8c..82032477dd 100644 --- a/mail/em-folder-view.h +++ b/mail/em-folder-view.h @@ -90,7 +90,7 @@ struct _EMFolderView { struct _BonoboUIComponent *uic; /* if we're active, this will be set */ GSList *enable_map; /* bonobo menu enable map, entries are 0-terminated EMFolderViewEnable arryas TODO: should this be on class? */ - + int mark_seen_timeout; /* local copy of gconf stuff */ guint mark_seen:1; guint preview_active:1; /* is preview being used */ @@ -101,10 +101,10 @@ struct _EMFolderView { struct _EMFolderViewClass { GtkVBoxClass parent_class; - + /* behaviour definition */ guint update_message_style:1; - + /* if used as a control, used to activate/deactivate custom menu's */ void (*activate)(EMFolderView *, struct _BonoboUIComponent *uic, int state); diff --git a/mail/em-format-hook.c b/mail/em-format-hook.c index 019c409b97..8b2f49f91e 100644 --- a/mail/em-format-hook.c +++ b/mail/em-format-hook.c @@ -253,7 +253,7 @@ GType em_format_hook_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMFormatHookClass), NULL, NULL, (GClassInitFunc) emfh_class_init, NULL, NULL, @@ -263,7 +263,7 @@ em_format_hook_get_type(void) emfh_parent_class = g_type_class_ref(e_plugin_hook_get_type()); type = g_type_register_static(e_plugin_hook_get_type(), "EMFormatHook", &info, 0); } - + return type; } diff --git a/mail/em-format-hook.h b/mail/em-format-hook.h index b4c7731dd4..387330b69e 100644 --- a/mail/em-format-hook.h +++ b/mail/em-format-hook.h @@ -65,9 +65,9 @@ struct _EMFormatHookGroup { /** * struct _EMFormatHook - Mail formatter hook. - * - * @hook: - * @groups: + * + * @hook: + * @groups: * * The Mail formatter hook links all of the plugin formatter hooks * into the relevent formatter classes. diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index b48d97630a..bc876815dd 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -121,7 +121,7 @@ #define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0) #endif -#define d(x) +#define d(x) #define EFHD_TABLE_OPEN "<table>" @@ -174,10 +174,10 @@ struct _attach_puri { /* Embedded Frame */ GtkHTMLEmbedded *html; - + /* Attachment */ EAttachment *attachment; - + /* image stuff */ int fit_width; int fit_height; @@ -186,7 +186,7 @@ struct _attach_puri { /* Optional Text Mem Stream */ CamelStreamMem *mstream; - + /* Signed / Encrypted */ camel_cipher_validity_sign_t sign; camel_cipher_validity_encrypt_t encrypt; @@ -260,7 +260,7 @@ efhd_gtkhtml_realise(GtkHTML *html, EMFormatHTMLDisplay *efhd) } efhd->formathtml.body_colour = ((r<<16) | (g<< 8) | b) & 0xffffff; - + #undef SCALE #define SCALE (174) /* choose a suitably darker or lighter colour */ @@ -359,13 +359,13 @@ efhd_class_init(GObjectClass *klass) ((EMFormatClass *)klass)->format_error = efhd_format_error; ((EMFormatClass *)klass)->format_source = efhd_format_source; ((EMFormatClass *)klass)->format_attachment = efhd_format_attachment; - ((EMFormatClass *)klass)->format_optional = efhd_format_optional; + ((EMFormatClass *)klass)->format_optional = efhd_format_optional; ((EMFormatClass *)klass)->format_secure = efhd_format_secure; ((EMFormatClass *)klass)->complete = efhd_complete; klass->finalize = efhd_finalise; - efhd_signals[EFHD_LINK_CLICKED] = + efhd_signals[EFHD_LINK_CLICKED] = g_signal_new("link_clicked", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -374,7 +374,7 @@ efhd_class_init(GObjectClass *klass) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - efhd_signals[EFHD_POPUP_EVENT] = + efhd_signals[EFHD_POPUP_EVENT] = g_signal_new("popup_event", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -385,7 +385,7 @@ efhd_class_init(GObjectClass *klass) GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE, G_TYPE_POINTER, G_TYPE_POINTER); - efhd_signals[EFHD_ON_URL] = + efhd_signals[EFHD_ON_URL] = g_signal_new("on_url", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -433,7 +433,7 @@ efhd_scroll_event(GtkWidget *w, GdkEventScroll *event, EMFormatHTMLDisplay *efhd } else if(event->direction == GDK_SCROLL_DOWN) { - gtk_html_zoom_out (efhd->formathtml.html); + gtk_html_zoom_out (efhd->formathtml.html); } return TRUE; } @@ -519,7 +519,7 @@ efhd_update_matches(EMFormatHTMLDisplay *efhd) gtk_label_set_text((GtkLabel *)p->search_matches_label, str); } gtk_widget_show((GtkWidget *)p->search_matches_label); - + } static void @@ -613,7 +613,7 @@ efhd_search_case_toggled(GtkWidget *w, EMFormatHTMLDisplay *efhd) efhd_search_response(w, efhd); } -static gboolean +static gboolean efhd_key_pressed (GtkWidget *w, GdkEventKey *event, EMFormatHTMLDisplay *efhd) { if (event->keyval == GDK_Escape){ @@ -696,7 +696,7 @@ em_format_html_get_search_dialog (EMFormatHTMLDisplay *efhd) gtk_widget_show (p->search_matches_label); gtk_box_pack_start (GTK_BOX (hbox2), p->search_matches_label, TRUE, TRUE, 0); p->search_dialog = GTK_HBOX (hbox2); - + p->search_wrap = FALSE; g_signal_connect (p->search_entry, "activate", G_CALLBACK(efhd_search_response), efhd); @@ -716,19 +716,19 @@ set_focus_cb (GtkWidget *window, GtkWidget *widget, EMFormatHTMLDisplay *efhd) { struct _EMFormatHTMLDisplayPrivate *p = efhd->priv; GtkWidget *sbar = GTK_WIDGET (p->search_dialog); - + while (widget != NULL && widget != sbar) { widget = widget->parent; } - if (widget != sbar) + if (widget != sbar) efhd_search_destroy(widget, efhd); } /** * em_format_html_display_search: - * @efhd: - * + * @efhd: + * * Run an interactive search dialogue. **/ void @@ -751,8 +751,8 @@ em_format_html_display_search(EMFormatHTMLDisplay *efhd) } /** * em_format_html_display_search_with: - * @efhd: - * + * @efhd: + * * Run an interactive search dialogue. **/ void @@ -762,7 +762,7 @@ em_format_html_display_search_with (EMFormatHTMLDisplay *efhd, char *word) if (p->search_dialog){ gtk_widget_show ( (GtkWidget *)(p->search_dialog)); - + /* Set the query */ gtk_entry_set_text (GTK_ENTRY (p->search_entry), word); gtk_widget_hide ( (GtkWidget *) p->search_entry_box); @@ -845,7 +845,7 @@ efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormat if (uri && !strncmp (uri, "##", 2)) return TRUE; - + if (uri) { puri = em_format_find_puri((EMFormat *)efhd, uri); d(printf("poup event, uri = '%s' part = '%p'\n", uri, puri?puri->part:NULL)); @@ -858,7 +858,7 @@ efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormat return res; } -gboolean +gboolean em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd) { GtkHTML *html; @@ -1038,7 +1038,7 @@ efhd_xpkcs7mime_add_cert_table(GtkWidget *vbox, EDList *certlist, struct _smime_ if (info->email) l = info->email; } - + if (l) { GtkWidget *w; #if defined(HAVE_NSS) @@ -1070,10 +1070,10 @@ efhd_xpkcs7mime_add_cert_table(GtkWidget *vbox, EDList *certlist, struct _smime_ #endif n++; } - + info = info->next; } - + gtk_box_pack_start((GtkBox *)vbox, (GtkWidget *)table, TRUE, TRUE, 6); } @@ -1204,10 +1204,10 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came || valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)) { char *classid; struct _smime_pobject *pobj; - + camel_stream_printf (stream, "<table border=0 width=\"100%%\" cellpadding=3 cellspacing=0%s><tr>", smime_sign_colour[valid->sign.status]); - + classid = g_strdup_printf("smime:///em-format-html/%s/icon/signed", emf->part_id->str); pobj = (struct _smime_pobject *)em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(*pobj), classid, part, efhd_xpkcs7mime_button); pobj->valid = camel_cipher_validity_clone(valid); @@ -1231,7 +1231,7 @@ efhd_image(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormat { char *classid; struct _attach_puri *info; - + classid = g_strdup_printf("image%s", ((EMFormat *)efh)->part_id->str); info = (struct _attach_puri *)em_format_add_puri((EMFormat *)efh, sizeof(*info), classid, part, efhd_attachment_frame); em_format_html_add_pobject(efh, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_image); @@ -1393,7 +1393,7 @@ static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePar now = time(NULL); if (now > date) camel_stream_printf(stream, "<b>%s</b> ", _("Overdue:")); - + localtime_r(&date, &due_tm); e_utf8_strftime_fix_am_pm(due_date, sizeof (due_date), _("by %B %d, %Y, %l:%M %p"), &due_tm); camel_stream_printf(stream, "%s %s", flag, due_date); @@ -1471,7 +1471,7 @@ static void efhd_popup_place_widget(GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer user_data) { GtkWidget *w = user_data; - + gdk_window_get_origin(gtk_widget_get_parent_window(w), x, y); *x += w->allocation.x + w->allocation.width; *y += w->allocation.y; @@ -1519,7 +1519,7 @@ efhd_attachment_popup(GtkWidget *w, GdkEventButton *event, struct _attach_puri * } e_popup_add_items((EPopup *)emp, menus, NULL, efhd_menu_items_free, info); - + menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, 0); if (event) gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time); @@ -1600,7 +1600,7 @@ static void efhd_drag_data_delete(GtkWidget *w, GdkDragContext *drag, EMFormatHTMLPObject *pobject) { char *uri; - + uri = g_object_get_data((GObject *)w, "e-drag-uri"); if (uri) { /* NB: this doesn't kill the dnd directory */ @@ -1665,9 +1665,9 @@ efhd_change_cursor(GtkWidget *w, GdkEventCrossing *event, struct _attach_puri *i static void efhd_image_fit_width(GtkWidget *widget, GdkEventButton *event, struct _attach_puri *info) -{ +{ int width; - + width = ((GtkWidget *)((EMFormatHTML *)info->puri.format)->html)->allocation.width - 12; if (info->shown && info->image) { @@ -1679,11 +1679,11 @@ efhd_image_fit_width(GtkWidget *widget, GdkEventButton *event, struct _attach_pu } else { info->fit_width = 0; e_cursor_set(widget->window, E_CURSOR_ZOOM_OUT); - } + } } } else { info->fit_width = width; - e_cursor_set (widget->window, E_CURSOR_ZOOM_IN); + e_cursor_set (widget->window, E_CURSOR_ZOOM_IN); } } @@ -1709,7 +1709,7 @@ efhd_image_unallocate (struct _EMFormatPURI * puri) static gboolean efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) { - GtkWidget *box; + GtkWidget *box; EMFormatHTMLJob *job; struct _attach_puri *info; GdkPixbuf *pixbuf; @@ -1724,13 +1724,13 @@ efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObjec info->image = (GtkImage *)gtk_image_new(); info->html = eb; info->puri.free = efhd_image_unallocate; - + pixbuf = em_icon_stream_get_image(pobject->classid, info->fit_width, info->fit_height); if (pixbuf) { gtk_image_set_from_pixbuf(info->image, pixbuf); g_object_unref(pixbuf); } else { - job = em_format_html_job_new(efh, efhd_write_icon_job, pobject); + job = em_format_html_job_new(efh, efhd_write_icon_job, pobject); job->stream = (CamelStream *)em_icon_stream_new((GtkImage *)info->image, pobject->classid, info->fit_width, info->fit_height, TRUE); em_format_html_job_queue(efh, job); } @@ -1742,10 +1742,10 @@ efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObjec gtk_container_add((GtkContainer *)eb, box); g_signal_connect(eb, "size_allocate", G_CALLBACK(efhd_image_resized), info); - + simple_type = camel_content_type_simple(((CamelDataWrapper *)pobject->part)->mime_type); camel_strdown(simple_type); - + drag_types[0].target = simple_type; gtk_drag_source_set(box, GDK_BUTTON1_MASK, drag_types, sizeof(drag_types)/sizeof(drag_types[0]), GDK_ACTION_COPY); g_free(simple_type); @@ -1756,7 +1756,7 @@ efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObjec g_signal_connect(box, "button_press_event", G_CALLBACK(efhd_image_popup), info); g_signal_connect(box, "enter-notify-event", G_CALLBACK(efhd_change_cursor), info); g_signal_connect(box, "popup_menu", G_CALLBACK(efhd_attachment_popup_menu), info); - g_signal_connect(box, "button-press-event", G_CALLBACK(efhd_image_fit_width), info); + g_signal_connect(box, "button-press-event", G_CALLBACK(efhd_image_fit_width), info); return TRUE; } @@ -1802,7 +1802,7 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje guint count = GPOINTER_TO_UINT(tmp); char *ext; char *tmp_file = g_strdup (file); - + if ((ext = strrchr(tmp_file, '.'))) { ext[0] = 0; new_file = g_strdup_printf("%s(%d).%s", tmp_file, count++, ext+1); @@ -1818,17 +1818,17 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(1)); } - /* Store the status of encryption / signature on the attachment for emblem display + /* Store the status of encryption / signature on the attachment for emblem display * FIXME: May not work well always */ new->sign = info->sign; new->encrypt = info->encrypt; - + /* Add the attachment to the bar.*/ e_attachment_bar_add_attachment(E_ATTACHMENT_BAR(efhd->priv->attachment_bar), new); efhd_attachment_bar_refresh(efhd); } - + mainbox = gtk_hbox_new(FALSE, 0); button = gtk_button_new(); @@ -1881,7 +1881,7 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje } } else { GdkPixbuf *pixbuf, *mini; - + if ((pixbuf = e_icon_for_mime_type (simple_type, 24))) { if ((mini = gdk_pixbuf_scale_simple (pixbuf, 24, 24, GDK_INTERP_BILINEAR))) { gtk_image_set_from_pixbuf ((GtkImage *) w, mini); @@ -1946,7 +1946,7 @@ efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject * CamelDataWrapper *wrapper; Bonobo_ServerInfo *component; GtkWidget *embedded; - Bonobo_PersistStream persist; + Bonobo_PersistStream persist; CORBA_Environment ev; CamelStreamMem *cstream; BonoboStream *bstream; @@ -1961,7 +1961,7 @@ efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject * CORBA_free(component); if (embedded == NULL) return FALSE; - + CORBA_exception_init(&ev); control_frame = bonobo_widget_get_control_frame((BonoboWidget *)embedded); @@ -1976,23 +1976,23 @@ efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject * */ const CamelInternetAddress *from; char *from_address; - + from = camel_mime_message_get_from((CamelMimeMessage *)((EMFormat *)efh)->message); from_address = camel_address_encode((CamelAddress *)from); bonobo_property_bag_client_set_value_string(prop_bag, "from_address", from_address, &ev); g_free(from_address); - + Bonobo_Unknown_unref(prop_bag, &ev); } - + persist = (Bonobo_PersistStream)Bonobo_Unknown_queryInterface(bonobo_widget_get_objref((BonoboWidget *)embedded), "IDL:Bonobo/PersistStream:1.0", &ev); if (persist == CORBA_OBJECT_NIL) { g_object_ref_sink(embedded); - CORBA_exception_free(&ev); + CORBA_exception_free(&ev); return FALSE; } - + /* Write the data to a CamelStreamMem... */ cstream = (CamelStreamMem *)camel_stream_mem_new(); wrapper = camel_medium_get_content_object((CamelMedium *)pobject->part); @@ -2003,11 +2003,11 @@ efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject * } else { camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) cstream); } - + /* ...convert the CamelStreamMem to a BonoboStreamMem... */ bstream = bonobo_stream_mem_create((char *)cstream->buffer->data, cstream->buffer->len, TRUE, FALSE); camel_object_unref(cstream); - + /* ...and hydrate the PersistStream from the BonoboStream. */ Bonobo_PersistStream_load(persist, bonobo_object_corba_objref(BONOBO_OBJECT (bstream)), @@ -2015,17 +2015,17 @@ efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject * bonobo_object_unref(BONOBO_OBJECT (bstream)); Bonobo_Unknown_unref(persist, &ev); CORBA_Object_release(persist, &ev); - + if (ev._major != CORBA_NO_EXCEPTION) { g_object_ref_sink(embedded); - CORBA_exception_free(&ev); + CORBA_exception_free(&ev); return FALSE; } CORBA_exception_free(&ev); - + gtk_widget_show(embedded); gtk_container_add(GTK_CONTAINER (eb), embedded); - + return TRUE; } @@ -2099,7 +2099,7 @@ attachment_bar_arrow_clicked(GtkWidget *w, EMFormatHTMLDisplay *efhd) } else { gtk_widget_hide(efhd->priv->attachment_box); gtk_widget_show(efhd->priv->forward); - gtk_widget_hide(efhd->priv->down); + gtk_widget_hide(efhd->priv->down); } } @@ -2133,17 +2133,17 @@ efhd_bar_popup_position(GtkMenu *menu, int *x, int *y, gboolean *push_in, gpoint GnomeIconList *icon_list = user_data; GList *selection; GnomeCanvasPixbuf *image; - + gdk_window_get_origin (((GtkWidget*) bar)->window, x, y); - + selection = gnome_icon_list_get_selection (icon_list); if (selection == NULL) return; - + image = gnome_icon_list_get_icon_pixbuf_item (icon_list, GPOINTER_TO_INT(selection->data)); if (image == NULL) return; - + /* Put menu to the center of icon. */ *x += (int)(image->item.x1 + image->item.x2) / 2; *y += (int)(image->item.y1 + image->item.y2) / 2; @@ -2157,7 +2157,7 @@ efhd_bar_save_selected(EPopup *ep, EPopupItem *item, void *data) GSList *parts = NULL; attachment_parts = e_attachment_bar_get_selected(E_ATTACHMENT_BAR(efhd->priv->attachment_bar)); - + for (tmp = attachment_parts; tmp; tmp=tmp->next) parts = g_slist_prepend(parts, ((EAttachment *)tmp->data)->body); @@ -2199,11 +2199,11 @@ efhd_bar_button_press_event(EAttachmentBar *bar, GdkEventButton *event, EMFormat /* Add something like save-selected, foward selected attachments in a mail etc....*/ list = e_attachment_bar_get_selected(bar); - + /* Lets not propagate any more the r-click which is intended to us*/ if ( g_slist_length (list) == 0) return TRUE; - + target = (EPopupTarget *)em_popup_target_new_attachments(emp, list); for (i=0; i<2; i++) menus = g_slist_prepend(menus, &efhd_bar_menu_items[i]); @@ -2220,7 +2220,7 @@ efhd_bar_button_press_event(EAttachmentBar *bar, GdkEventButton *event, EMFormat } static gboolean -efhd_bar_popup_menu_event (EAttachmentBar *bar, EMFormat *emf) +efhd_bar_popup_menu_event (EAttachmentBar *bar, EMFormat *emf) { return efhd_bar_button_press_event(bar, NULL, emf); } @@ -2241,12 +2241,12 @@ efhd_attachment_bar_refresh (EMFormatHTMLDisplay *efhd) txt = g_strdup_printf(ngettext("%d at_tachment", "%d at_tachments", nattachments), nattachments); gtk_label_set_text_with_mnemonic ((GtkLabel *)efhd->priv->label, txt); g_free (txt); - + /* Show the bar even when the first attachment is added */ if (nattachments == 1) { gtk_widget_show_all (efhd->priv->attachment_area); gtk_label_set_text_with_mnemonic ((GtkLabel *)efhd->priv->save_txt, _("S_ave")); - + if (efhd->priv->show_bar) { gtk_widget_show(efhd->priv->down); gtk_widget_hide(efhd->priv->forward); @@ -2256,7 +2256,7 @@ efhd_attachment_bar_refresh (EMFormatHTMLDisplay *efhd) gtk_widget_hide(efhd->priv->attachment_box); } } else if (nattachments > 1) { - gtk_label_set_text_with_mnemonic ((GtkLabel *)efhd->priv->save_txt, _("S_ave All")); + gtk_label_set_text_with_mnemonic ((GtkLabel *)efhd->priv->save_txt, _("S_ave All")); } } } @@ -2270,7 +2270,7 @@ efhd_bar_resize(GtkWidget *w, GtkAllocation *event, EMFormatHTML *efh) gtk_widget_size_request (efhd->priv->attachment_bar, &req); width = ((GtkWidget *) efh->html)->allocation.width - 16; - + /* Update the width of the bar when the width is greater than 1*/ if (width > 0) e_attachment_bar_set_width(E_ATTACHMENT_BAR(efhd->priv->attachment_bar), width); @@ -2289,7 +2289,7 @@ efhd_bar_scroll_event(GtkWidget *w, GdkEventScroll *event, EMFormatHTMLDisplay * return TRUE; } -gboolean +gboolean efhd_mnemonic_show_bar (GtkWidget *widget, gboolean focus, GtkWidget *efhd) { attachment_bar_arrow_clicked (NULL, (EMFormatHTMLDisplay *)efhd); @@ -2309,7 +2309,7 @@ efhd_add_bar(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobjec scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); ((EAttachmentBar *)priv->attachment_bar)->expand = TRUE; - + priv->forward = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE); priv->down = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); hbox3 = gtk_hbox_new (FALSE, 0); @@ -2345,10 +2345,10 @@ efhd_add_bar(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobjec /* FIXME: What if the text is more?. Should we reduce the text with appending ...? * or resize the bar? How to figure out that, it needs more space? */ bar_width = ((GtkWidget *)efh->html)->parent->allocation.width - /* FIXME */16; - gtk_widget_set_size_request (priv->attachment_bar, + gtk_widget_set_size_request (priv->attachment_bar, bar_width > 0 ? bar_width : 0, 84 /* FIXME: Default show only one row, Dont hardcode size*/); - + vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *)vbox, hbox2, FALSE, FALSE, 2); gtk_box_pack_start ((GtkBox *)vbox, priv->attachment_box, TRUE, TRUE, 2); @@ -2359,7 +2359,7 @@ efhd_add_bar(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobjec /* Lets hide it by default and show only when there are attachments */ priv->attachment_area = vbox; gtk_widget_hide_all (priv->attachment_area); - + g_signal_connect (priv->arrow, "clicked", G_CALLBACK(attachment_bar_arrow_clicked), efh); g_signal_connect (priv->attachment_bar, "button_press_event", G_CALLBACK(efhd_bar_button_press_event), efhd); g_signal_connect (priv->attachment_bar, "popup-menu", G_CALLBACK(efhd_bar_popup_menu_event), efhd); @@ -2443,16 +2443,16 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, g_free(classid); } -static void +static void efhd_optional_button_show (GtkWidget *widget, GtkWidget *w) { GtkWidget *label = g_object_get_data (G_OBJECT (widget), "text-label"); - + if (GTK_WIDGET_VISIBLE (w)) { gtk_widget_hide (w); gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _("View _Unformatted")); } else { - gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _("Hide _Unformatted")); + gtk_label_set_text_with_mnemonic (GTK_LABEL (label), _("Hide _Unformatted")); gtk_widget_show (w); } } @@ -2480,9 +2480,9 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb if (!info || info->forward) { g_warning ("unable to expand the attachment\n"); return TRUE; - } + } - scroll = gtk_scrolled_window_new (NULL, NULL); + scroll = gtk_scrolled_window_new (NULL, NULL); mainbox = gtk_hbox_new(FALSE, 0); button = gtk_button_new(); @@ -2500,7 +2500,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb gtk_widget_set_sensitive(button, FALSE); GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); } - + vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start(GTK_BOX (mainbox), button, FALSE, FALSE, 6); @@ -2513,7 +2513,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb gtk_box_pack_start (GTK_BOX (hbox), gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE), TRUE, TRUE, 2); gtk_widget_show_all (hbox); gtk_container_add (GTK_CONTAINER (button), GTK_WIDGET (hbox)); - + a11y = gtk_widget_get_accessible (button); atk_object_set_name (a11y, _("Attachment")); @@ -2546,7 +2546,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb if (!info->shown) gtk_widget_hide (scroll); - + gtk_widget_show (vbox); gtk_container_add(GTK_CONTAINER (eb), vbox); info->handle = NULL; @@ -2560,7 +2560,7 @@ efhd_format_optional(EMFormat *emf, CamelStream *fstream, CamelMimePart *part, C char *classid, *html; struct _attach_puri *info; CamelStream *stream = ((CamelStreamFilter *) fstream)->source; - + classid = g_strdup_printf("optional%s", emf->part_id->str); info = (struct _attach_puri *)em_format_add_puri(emf, sizeof(*info), classid, part, efhd_attachment_frame); em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_optional); @@ -2584,7 +2584,7 @@ efhd_format_optional(EMFormat *emf, CamelStream *fstream, CamelMimePart *part, C "</font></h3></td></tr></table>\n"); camel_stream_write_string(stream, "<table cellspacing=0 cellpadding=0>" - "<tr>"); + "<tr>"); camel_stream_printf(stream, "<td><object classid=\"%s\"></object></td></tr></table>", classid); g_free(html); diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 400cf5fad5..228a8aa3ef 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -156,7 +156,7 @@ efh_init(GObject *o) gtk_html_set_default_content_type(efh->html, "text/html; charset=utf-8"); gtk_html_set_editable(efh->html, FALSE); - + g_signal_connect(efh->html, "destroy", G_CALLBACK(efh_gtkhtml_destroy), efh); g_signal_connect(efh->html, "url_requested", G_CALLBACK(efh_url_requested), efh); g_signal_connect(efh->html, "object_requested", G_CALLBACK(efh_object_requested), efh); @@ -236,7 +236,7 @@ efh_class_init(GObjectClass *klass) ((EMFormatClass *)klass)->format_attachment = efh_format_attachment; ((EMFormatClass *)klass)->format_secure = efh_format_secure; ((EMFormatClass *)klass)->busy = efh_busy; - + klass->finalize = efh_finalise; } @@ -526,7 +526,7 @@ static void emfh_gethttp(struct _EMFormatHTMLJob *job, int cancelled) } else if (n < 0 && costream) { camel_data_cache_remove(emfh_http_cache, EMFH_HTTP_CACHE_PATH, job->u.uri, NULL); camel_object_unref(costream); - costream = NULL; + costream = NULL; } } while (n>0); @@ -584,7 +584,7 @@ efh_url_requested(GtkHTML *html, const char *url, GtkHTMLStream *handle, EMForma char *data = NULL; gsize length = 0; gboolean status; - + status = g_file_get_contents (url, &data, &length, NULL); if (status) gtk_html_stream_write (handle, data, length); @@ -669,13 +669,13 @@ efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Camel char *classid, *iconpath; const char *icon; CamelMimePart *iconpart; - + camel_stream_printf (stream, "<table border=0 width=\"100%%\" cellpadding=3 cellspacing=0%s><tr>", smime_sign_colour[valid->sign.status]); - + classid = g_strdup_printf("smime:///em-format-html/%s/icon/signed", emf->part_id->str); camel_stream_printf(stream, "<td valign=\"top\"><img src=\"%s\"></td><td valign=\"top\" width=\"100%%\">", classid); - + if (valid->sign.status != 0) icon = smime_sign_table[valid->sign.status].icon; else @@ -700,7 +700,7 @@ efh_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Camel camel_stream_printf(stream, "</td></tr></table>"); } } - + static void efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { @@ -715,7 +715,7 @@ efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFo struct _EMFormatHTMLCache *efhc; flags = efh->text_html_flags; - + dw = camel_medium_get_content_object((CamelMedium *)part); /* Check for RFC 2646 flowed text. */ @@ -809,16 +809,16 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E CamelMimeFilter *enriched; CamelDataWrapper *dw; guint32 flags = 0; - + dw = camel_medium_get_content_object((CamelMedium *)part); - + if (!strcmp(info->mime_type, "text/richtext")) { flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT; camel_stream_write_string( stream, "\n<!-- text/richtext -->\n"); } else { camel_stream_write_string( stream, "\n<!-- text/enriched -->\n"); } - + enriched = camel_mime_filter_enriched_new(flags); filtered_stream = camel_stream_filter_new_with_stream (stream); camel_stream_filter_add(filtered_stream, enriched); @@ -829,7 +829,7 @@ efh_text_enriched(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, E efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff); em_format_format_text((EMFormat *)efh, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); - + camel_object_unref(filtered_stream); camel_stream_write_string(stream, "</div>"); } @@ -880,7 +880,7 @@ efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFor } else { if (strchr(location, ':') == NULL && ((EMFormat *)efh)->base != NULL) { CamelURL *uri; - + uri = camel_url_new_with_base(((EMFormat *)efh)->base, location); cid = camel_url_to_string(uri, 0); camel_url_free(uri); @@ -918,7 +918,7 @@ efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part camel_stream_printf(stream, _("Malformed external-body part.")); return; } - + if (!g_ascii_strcasecmp(access_type, "ftp") || !g_ascii_strcasecmp(access_type, "anon-ftp")) { const char *name, *site, *dir, *mode; @@ -931,7 +931,7 @@ efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part mode = camel_content_type_param (type, "mode"); if (name == NULL || site == NULL) goto fail; - + /* Generate the path. */ if (dir) path = g_strdup_printf("/%s/%s", *dir=='/'?dir+1:dir, name); @@ -942,18 +942,18 @@ efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part sprintf(ftype, ";type=%c", *mode); else ftype[0] = 0; - + url = g_strdup_printf ("ftp://%s%s%s", site, path, ftype); g_free (path); desc = g_strdup_printf (_("Pointer to FTP site (%s)"), url); } else if (!g_ascii_strcasecmp (access_type, "local-file")) { const char *name, *site; - + name = camel_content_type_param (type, "name"); site = camel_content_type_param (type, "site"); if (name == NULL) goto fail; - + url = g_filename_to_uri (name, NULL, NULL); if (site) desc = g_strdup_printf(_("Pointer to local file (%s) valid at site \"%s\""), name, site); @@ -962,13 +962,13 @@ efh_message_external(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part } else if (!g_ascii_strcasecmp (access_type, "URL")) { const char *urlparam; char *s, *d; - + /* RFC 2017 */ - + urlparam = camel_content_type_param (type, "url"); if (urlparam == NULL) goto fail; - + /* For obscure MIMEy reasons, the URL may be split into words */ url = g_strdup (urlparam); s = d = url; @@ -1075,8 +1075,8 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c em_format_format_source(emf, stream, part); return; } - - nparts = camel_multipart_get_number(mp); + + nparts = camel_multipart_get_number(mp); content_type = camel_mime_part_get_content_type(part); start = camel_content_type_param (content_type, "start"); if (start && strlen(start)>2) { @@ -1086,11 +1086,11 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c /* strip <>'s */ len = strlen (start) - 2; start++; - + for (i=0; i<nparts; i++) { body_part = camel_multipart_get_part(mp, i); cid = camel_mime_part_get_content_id(body_part); - + if (cid && !strncmp(cid, start, len) && strlen(cid) == len) { display_part = body_part; displayid = i; @@ -1100,12 +1100,12 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c } else { display_part = camel_multipart_get_part(mp, 0); } - + if (display_part == NULL) { em_format_part_as(emf, stream, part, "multipart/mixed"); return; } - + em_format_push_level(emf); partidlen = emf->part_id->len; @@ -1120,7 +1120,7 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c d(printf(" part '%s' '%s' added\n", puri->uri?puri->uri:"", puri->cid)); } } - + g_string_append_printf(emf->part_id, "related.%d", displayid); em_format_part(emf, stream, display_part); g_string_truncate(emf->part_id, partidlen); @@ -1228,7 +1228,7 @@ static void efh_format_do(struct _mail_msg *mm) int cancelled = FALSE; CamelURL *base; - if (m->format->html == NULL) + if (m->format->html == NULL) return; camel_stream_printf((CamelStream *)m->estream, @@ -1401,7 +1401,7 @@ efh_format_timeout(struct _format_msg *m) p->last_part = m->message; } - + efh->priv->format_id = m->msg.seq; e_thread_put(mail_thread_new, (EMsg *)m); } @@ -1471,13 +1471,13 @@ efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const char *lab { char *mhtml = NULL; const char *fmt, *html; - + if (value == NULL) return; - + while (*value == ' ') value++; - + if (flags & EM_FORMAT_HTML_HEADER_HTML) html = value; else @@ -1494,8 +1494,8 @@ efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const char *lab } else if (flags & EM_FORMAT_HTML_HEADER_NODEC) { fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s<b> </b></th><td valign=top>%s</td></tr>"; } else { - - if (flags & EM_FORMAT_HEADER_BOLD) + + if (flags & EM_FORMAT_HEADER_BOLD) fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s:<b> </b></th><td>%s</td></tr>"; else fmt = "<tr><td align=\"right\" valign=\"top\" nowrap>%s:<b> </b></td><td>%s</td></tr>"; @@ -1528,18 +1528,18 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres || (!strcmp (field, _("Bcc")) && !(efh->header_wrap_flags & EM_FORMAT_HTML_HEADER_BCC))) wrap = TRUE; } - + while (a) { if (a->name) name = camel_text_to_html (a->name, flags, 0); else name = NULL; - + switch (a->type) { case CAMEL_HEADER_ADDRESS_NAME: if (name && *name) { char *real, *mailaddr; - + g_string_append_printf (out, "%s <", name); /* rfc2368 for mailto syntax and url encoding extras */ if ((real = camel_header_encode_phrase ((unsigned char *)a->name))) { @@ -1557,7 +1557,7 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres g_string_append_printf (out, "<a href=\"mailto:%s\">%s</a>", mailto, addr); g_free (mailto); g_free (addr); - + if (name && *name) g_string_append (out, ">"); break; @@ -1570,7 +1570,7 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres g_warning ("Invalid address type"); break; } - + g_free (name); i++; @@ -1580,12 +1580,12 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres /* Let us add a '...' if we have more addresses */ if (limit > 0 && wrap && a && (i>(limit-1))) { - + if (!strcmp (field, _("To"))) { - + g_string_append (out, "<a href=\"##TO##\">...</a>"); str = g_strdup_printf ("<a href=\"##TO##\"><img src=\"%s/plus.png\" /></a> ", EVOLUTION_ICONSDIR); - + return str; } else if (!strcmp (field, _("Cc"))) { @@ -1601,12 +1601,12 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres return str; } } - + } if (limit > 0 && i>(limit)) { - + if (!strcmp (field, _("To"))) { str = g_strdup_printf ("<a href=\"##TO##\"><img src=\"%s/minus.png\" /></a> ", EVOLUTION_ICONSDIR); } @@ -1619,7 +1619,7 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres } return str; - + } static void @@ -1630,26 +1630,26 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct const char *label, *txt; int addrspec = 0, i; char *str_field = NULL; - + name = alloca(strlen(header->name)+1); strcpy(name, header->name); camel_strdown(name); - + for (i = 0; addrspec_hdrs[i]; i++) { if (!strcmp(name, addrspec_hdrs[i])) { addrspec = 1; break; } } - + if (addrspec) { struct _camel_header_address *addrs; GString *html; char *img; - + if (!(addrs = camel_header_address_decode(header->value, emf->charset ? emf->charset : emf->default_charset))) return; - + /* canonicalise the header name... first letter is * capitalised and any letter following a '-' also gets * capitalised */ @@ -1660,15 +1660,15 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct if (p[-1] == '-' && *p >= 'a' && *p <= 'z') *p -= 0x20; } while (*p); - + label = _(name); - + html = g_string_new(""); img = efh_format_address(efh, html, addrs, (char *)label); - + if (img) { // str_field = g_strdup_printf ("<table><tr><td valign=top>%s</td><td valign=top><b>%s:</b></td></tr></table>", img, label); - str_field = g_strdup_printf ("%s%s:", img, label); + str_field = g_strdup_printf ("%s%s:", img, label); label = str_field; flags |= EM_FORMAT_HTML_HEADER_NODEC; g_free (img); @@ -1676,7 +1676,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct camel_header_address_unref(addrs); txt = value = html->str; g_string_free(html, FALSE); - + flags |= EM_FORMAT_HEADER_BOLD | EM_FORMAT_HTML_HEADER_HTML; } else if (!strcmp(name, "subject")) { txt = value = camel_header_decode_string (header->value, charset); @@ -1691,23 +1691,23 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct int msg_offset, local_tz; time_t msg_date; struct tm local; - + txt = header->value; while (*txt == ' ') txt++; - + /* Show the local timezone equivalent in brackets if the sender is remote */ msg_date = camel_header_decode_date(txt, &msg_offset); e_localtime_with_offset(msg_date, &local, &local_tz); - + /* Convert message offset to minutes (e.g. -0400 --> -240) */ msg_offset = ((msg_offset / 100) * 60) + (msg_offset % 100); /* Turn into offset from localtime, not UTC */ msg_offset -= local_tz / 60; - + if (msg_offset) { char buf[256], *html; - + msg_offset += (local.tm_hour * 60) + local.tm_min; if (msg_offset >= (24 * 60) || msg_offset < 0) { /* translators: strftime format for local time equivalent in Date header display, with day */ @@ -1720,18 +1720,18 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct e_utf8_strftime(buf, sizeof(buf), msg, &local); g_free(msg); } - + html = camel_text_to_html(txt, efh->text_html_flags, 0); txt = value = g_strdup_printf("%s %s", html, buf); g_free(html); flags |= EM_FORMAT_HTML_HEADER_HTML; } - + if (!strcmp(name, "date")) label = _("Date"); else label = "Resent-Date"; - + flags |= EM_FORMAT_HEADER_BOLD; } else if (!strcmp(name, "newsgroups")) { GString *html; @@ -1751,7 +1751,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct } camel_header_newsgroups_free(ng); - label = _("Newsgroups"); + label = _("Newsgroups"); txt = html->str; g_string_free(html, FALSE); flags |= EM_FORMAT_HEADER_BOLD|EM_FORMAT_HTML_HEADER_HTML; @@ -1759,9 +1759,9 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct txt = value = camel_header_decode_string(header->value, charset); label = header->name; } - + efh_format_text_header(efh, stream, label, txt, flags); - + g_free(value); g_free (str_field); } @@ -1782,13 +1782,13 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) gsize face_header_len = 0; char *header_sender = NULL, *header_from = NULL, *name; gboolean mail_from_delegate = FALSE; - + if (!part) return; ct = camel_mime_part_get_content_type((CamelMimePart *)part); charset = camel_content_type_param (ct, "charset"); - charset = e_iconv_charset_name(charset); + charset = e_iconv_charset_name(charset); if (!efh->simple_headers) camel_stream_printf(stream, @@ -1804,24 +1804,24 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (!(addrs = camel_header_address_decode(header->value, emf->charset ? emf->charset : emf->default_charset))) return; - + html = g_string_new(""); name = efh_format_address(efh, html, addrs, header->name); header_sender= html->str; camel_header_address_unref(addrs); - + g_string_free(html, FALSE); g_free (name); } - + if(!g_ascii_strcasecmp (header->name, "From")) { struct _camel_header_address *addrs; GString *html; - + if (!(addrs = camel_header_address_decode(header->value, emf->charset ? emf->charset : emf->default_charset))) return; - + html = g_string_new(""); name = efh_format_address(efh, html, addrs, header->name); @@ -1834,18 +1834,18 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (!g_ascii_strcasecmp (header->name, "X-Evolution-Mail-From-Delegate")) mail_from_delegate = TRUE; - + if (header_sender && header_from && mail_from_delegate) { camel_stream_printf(stream, "<tr><td><table border=1 width=\"100%%\" cellspacing=2 cellpadding=2><tr>"); camel_stream_printf(stream, "<td align=\"left\" width=\"100%%\">"); /* To translators: This message suggests to the receipients that the sender of the mail is different from the one listed in From field. - */ + */ camel_stream_printf(stream, _("This message was sent by <b>%s</b> on behalf of <b>%s</b>"), header_sender, header_from); camel_stream_printf(stream, "</td></tr></table></td></tr>"); break; } - + header = header->next; } @@ -1869,21 +1869,21 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) header = ((CamelMimePart *)part)->headers; mailer = !g_ascii_strcasecmp (h->name, "X-Evolution-Mailer"); - + while (header) { if (emf->show_photo && !photo_name && !g_ascii_strcasecmp (header->name, "From")) photo_name = header->value; - + if (!mailer_shown && mailer && (!g_ascii_strcasecmp (header->name, "X-Mailer") || !g_ascii_strcasecmp (header->name, "User-Agent") || !g_ascii_strcasecmp (header->name, "X-Newsreader"))) { struct _camel_header_raw xmailer; - + xmailer.name = "X-Evolution-Mailer"; xmailer.value = header->value; mailer_shown = TRUE; - + efh_format_header (emf, stream, part, &xmailer, h->flags, charset); if (strstr(header->value, "Evolution")) have_icon = TRUE; @@ -1906,14 +1906,14 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) h = h->next; } } - + if (!efh->simple_headers) { camel_stream_printf(stream, "</table></td>"); if (photo_name) { char *classid; CamelMimePart *photopart; - + cia = camel_internet_address_new(); camel_address_decode((CamelAddress *) cia, (const char *) photo_name); photopart = em_utils_contact_photo (cia, emf->photo_local); @@ -1932,8 +1932,8 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) g_free(classid); } camel_object_unref(cia); - } - + } + if (!contact_has_photo && face_decoded) { char *classid; CamelMimePart *part; @@ -1994,7 +1994,7 @@ static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart handle = em_format_find_handler(emf, "x-evolution/message/post-header"); if (handle) handle->handler(emf, stream, part, handle); - + camel_stream_printf(stream, EM_FORMAT_HTML_VPAD); em_format_part(emf, stream, part); @@ -2019,11 +2019,11 @@ static void efh_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart | CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0); camel_stream_filter_add(filtered_stream, html_filter); camel_object_unref(html_filter); - + camel_stream_write_string((CamelStream *)stream, EFH_TABLE_OPEN "<tr><td><tt>"); em_format_format_text(emf, (CamelStream *)filtered_stream, dw); camel_object_unref(filtered_stream); - + camel_stream_write_string(stream, "</tt></td></tr></table>"); } diff --git a/mail/em-format-html.h b/mail/em-format-html.h index 025bb9893f..d0a6655dc3 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -57,7 +57,7 @@ typedef struct _EMFormatHTMLJob EMFormatHTMLJob; /** * struct _EMFormatHTMLJob - A formatting job. - * + * * @next: Double linked list header. * @prev: Double linked list header. * @format: Set by allocation function. @@ -68,7 +68,7 @@ typedef struct _EMFormatHTMLJob EMFormatHTMLJob; * cancelled the display. So the callback should free any extra data * it allocated every time it is called. * @u: Union data, free for caller to use. - * + * * This object is used to queue a long-running-task which cannot be * processed in the primary thread. When its turn comes, the job will * be de-queued and the @callback invoked to perform its processing, @@ -107,7 +107,7 @@ typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, struct _GtkHTMLEmb /** * struct _EMFormatHTMLPObject - Pending object. - * + * * @next: Double linked list header. * @prev: Double linked list header. * @free: Invoked when the object is no longer needed. @@ -115,7 +115,7 @@ typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, struct _GtkHTMLEmb * @classid: The assigned class id as passed to add_pobject(). * @func: Callback function. * @part: The part as passed to add_pobject(). - * + * * This structure is used to track OBJECT tags which have been * inserted into the HTML stream. When GtkHTML requests them the * @func will be invoked to create the embedded widget. @@ -145,25 +145,25 @@ struct _EMFormatHTMLPObject { /** * struct _EMFormatHTML - HTML formatter object. - * - * @format: - * @priv: - * @html: - * @pending_object_list: - * @headers: - * @text_html_flags: - * @body_colour: - * @text_colour: - * @frame_colour: - * @content_colour: - * @citation_colour: - * @load_http:2: - * @load_http_now:1: - * @mark_citations:1: - * @simple_headers:1: - * @hide_headers:1: - * @show_icon:1: - * + * + * @format: + * @priv: + * @html: + * @pending_object_list: + * @headers: + * @text_html_flags: + * @body_colour: + * @text_colour: + * @frame_colour: + * @content_colour: + * @citation_colour: + * @load_http:2: + * @load_http_now:1: + * @mark_citations:1: + * @simple_headers:1: + * @hide_headers:1: + * @show_icon:1: + * * Most of these fields are private or read-only. * * The base HTML formatter object. This object drives HTML generation @@ -193,12 +193,12 @@ struct _EMFormatHTML { unsigned int simple_headers:1; /* simple header format, no box/table */ unsigned int hide_headers:1; /* no headers at all */ unsigned int show_icon:1; /* show an icon when the sender used Evo */ - guint32 header_wrap_flags; + guint32 header_wrap_flags; }; struct _EMFormatHTMLClass { EMFormatClass format_class; - + }; GType em_format_html_get_type(void); diff --git a/mail/em-format-quote.c b/mail/em-format-quote.c index e92147304e..69626b951a 100644 --- a/mail/em-format-quote.c +++ b/mail/em-format-quote.c @@ -56,11 +56,11 @@ static EMFormatClass *emfq_parent; static void emfq_init(GObject *o) -{ +{ EMFormatQuote *emfq =(EMFormatQuote *) o; - + emfq->priv = g_malloc0(sizeof(*emfq->priv)); - + /* we want to convert url's etc */ emfq->text_html_flags = CAMEL_MIME_FILTER_TOHTML_PRE | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES; @@ -75,7 +75,7 @@ emfq_finalise(GObject *o) camel_object_unref(emfq->stream); g_free(emfq->credits); g_free(emfq->priv); - + ((GObjectClass *) emfq_parent)->finalize(o); } @@ -92,7 +92,7 @@ emfq_class_init(GObjectClass *klass) ((EMFormatClass *) klass)->format_error = emfq_format_error; ((EMFormatClass *) klass)->format_source = emfq_format_source; ((EMFormatClass *) klass)->format_attachment = emfq_format_attachment; - + klass->finalize = emfq_finalise; } @@ -100,7 +100,7 @@ GType em_format_quote_get_type(void) { static GType type = 0; - + if (type == 0) { static const GTypeInfo info = { sizeof(EMFormatQuoteClass), @@ -110,11 +110,11 @@ em_format_quote_get_type(void) sizeof(EMFormatQuote), 0, (GInstanceInitFunc) emfq_init }; - + emfq_parent = g_type_class_ref(em_format_get_type()); type = g_type_register_static(em_format_get_type(), "EMFormatQuote", &info, 0); } - + return type; } @@ -122,14 +122,14 @@ EMFormatQuote * em_format_quote_new(const char *credits, CamelStream *stream, guint32 flags) { EMFormatQuote *emfq; - + emfq = (EMFormatQuote *)g_object_new(em_format_quote_get_type(), NULL); emfq->credits = g_strdup(credits); emfq->stream = stream; camel_object_ref(stream); emfq->flags = flags; - + return emfq; } @@ -155,7 +155,7 @@ emfq_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMime handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle); handle = em_format_find_handler(emf, "x-evolution/message/rfc822"); if (handle) - handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle); + handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle); camel_stream_flush(emfq->stream); @@ -173,23 +173,23 @@ emfq_format_text_header (EMFormatQuote *emfq, CamelStream *stream, const char *l { const char *fmt, *html; char *mhtml = NULL; - + if (value == NULL) return; - + while (*value == ' ') value++; - + if (!is_html) html = mhtml = camel_text_to_html (value, 0, 0); else html = value; - + if (flags & EM_FORMAT_HEADER_BOLD) fmt = "<b>%s</b>: %s<br>"; else fmt = "%s: %s<br>"; - + camel_stream_printf (stream, fmt, label, html); g_free (mhtml); } @@ -213,18 +213,18 @@ emfq_format_address (GString *out, struct _camel_header_address *a) { guint32 flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES; char *name, *mailto, *addr; - + while (a) { if (a->name) name = camel_text_to_html (a->name, flags, 0); else name = NULL; - + switch (a->type) { case CAMEL_HEADER_ADDRESS_NAME: if (name && *name) { char *real, *mailaddr; - + g_string_append_printf (out, "%s <", name); /* rfc2368 for mailto syntax and url encoding extras */ if ((real = camel_header_encode_phrase ((unsigned char *)a->name))) { @@ -242,7 +242,7 @@ emfq_format_address (GString *out, struct _camel_header_address *a) g_string_append_printf (out, "<a href=\"mailto:%s\">%s</a>", mailto, addr); g_free (mailto); g_free (addr); - + if (name && *name) g_string_append (out, ">"); break; @@ -255,9 +255,9 @@ emfq_format_address (GString *out, struct _camel_header_address *a) g_warning ("Invalid address type"); break; } - + g_free (name); - + a = a->next; if (a) g_string_append (out, ", "); @@ -273,28 +273,28 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const const char *txt, *label; int addrspec = 0, i; int is_html = FALSE; - + name = g_alloca (strlen (namein) + 1); strcpy (name, namein); camel_strdown (name); - + for (i = 0; addrspec_hdrs[i]; i++) { if (!strcmp (name, addrspec_hdrs[i])) { addrspec = 1; break; } } - + if (addrspec) { struct _camel_header_address *addrs; GString *html; - + if (!(txt = camel_medium_get_header (part, name))) return; - + if (!(addrs = camel_header_address_decode (txt, emf->charset ? emf->charset : emf->default_charset))) return; - + /* canonicalise the header name... first letter is * capitalised and any letter following a '-' also gets * capitalised */ @@ -305,9 +305,9 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const if (p[-1] == '-' && *p >= 'a' && *p <= 'z') *p -= 0x20; } while (*p); - + label = _(name); - + html = g_string_new (""); emfq_format_address (html, addrs); camel_header_address_unref (addrs); @@ -323,20 +323,20 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const if (!(txt = camel_medium_get_header (part, "x-mailer"))) if (!(txt = camel_medium_get_header (part, "user-agent"))) return; - + txt = value = camel_header_format_ctext (txt, charset); - + label = _("Mailer"); flags |= EM_FORMAT_HEADER_BOLD; } else if (!strcmp (name, "date") || !strcmp (name, "resent-date")) { if (!(txt = camel_medium_get_header (part, name))) return; - + if (!strcmp (name, "date")) label = _("Date"); else label = "Resent-Date"; - + flags |= EM_FORMAT_HEADER_BOLD; } else { txt = camel_medium_get_header (part, name); @@ -344,9 +344,9 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const txt = value; label = namein; } - + emfq_format_text_header (emfq, stream, label, txt, flags, is_html); - + g_free (value); } @@ -357,14 +357,14 @@ emfq_format_headers (EMFormatQuote *emfq, CamelStream *stream, CamelMedium *part CamelContentType *ct; const char *charset; EMFormatHeader *h; - + if (!part) return; ct = camel_mime_part_get_content_type ((CamelMimePart *) part); charset = camel_content_type_param (ct, "charset"); - charset = e_iconv_charset_name (charset); - + charset = e_iconv_charset_name (charset); + /* dump selected headers */ h = (EMFormatHeader *) emf->header_list.head; while (h->next) { @@ -400,9 +400,9 @@ emfq_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con emfq_format_headers (emfq, stream, (CamelMedium *)part); } else if (emfq->flags & EM_FORMAT_QUOTE_HEADERS) emfq_format_headers (emfq, stream, (CamelMedium *)part); - + em_format_part (emf, stream, part); - + if (emfq->flags & EM_FORMAT_QUOTE_CITE) camel_stream_write_string(stream, "</blockquote></font><!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">-->"); } @@ -419,7 +419,7 @@ emfq_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart *part) | CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT, 0); camel_stream_filter_add(filtered_stream, html_filter); camel_object_unref(html_filter); - + em_format_format_text(emf, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); camel_object_unref(filtered_stream); } @@ -465,26 +465,26 @@ emfq_text_plain(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, E return; flags = emfq->text_html_flags; - + /* Check for RFC 2646 flowed text. */ type = camel_mime_part_get_content_type(part); if (camel_content_type_is(type, "text", "plain") && (format = camel_content_type_param(type, "format")) && !g_ascii_strcasecmp(format, "flowed")) flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED; - + filtered_stream = camel_stream_filter_new_with_stream(stream); - + if (emfq->flags != 0) { sig_strip = em_stripsig_filter_new (); camel_stream_filter_add (filtered_stream, sig_strip); camel_object_unref (sig_strip); } - + html_filter = camel_mime_filter_tohtml_new(flags, rgb); camel_stream_filter_add(filtered_stream, html_filter); camel_object_unref(html_filter); - + em_format_format_text((EMFormat *)emfq, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); camel_stream_flush((CamelStream *)filtered_stream); camel_object_unref(filtered_stream); @@ -497,16 +497,16 @@ emfq_text_enriched(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part CamelMimeFilter *enriched; CamelDataWrapper *dw; guint32 flags = 0; - + dw = camel_medium_get_content_object((CamelMedium *)part); - + if (!strcmp(info->mime_type, "text/richtext")) { flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT; camel_stream_write_string(stream, "\n<!-- text/richtext -->\n"); } else { camel_stream_write_string(stream, "\n<!-- text/enriched -->\n"); } - + enriched = camel_mime_filter_enriched_new(flags); filtered_stream = camel_stream_filter_new_with_stream (stream); camel_stream_filter_add(filtered_stream, enriched); @@ -548,7 +548,7 @@ static void emfq_builtin_init(EMFormatQuoteClass *efhc) { int i; - + for (i=0;i<sizeof(type_builtin_table)/sizeof(type_builtin_table[0]);i++) em_format_class_add_handler((EMFormatClass *)efhc, &type_builtin_table[i]); } diff --git a/mail/em-format.c b/mail/em-format.c index 5bedde4007..36177d7991 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -56,7 +56,7 @@ #include "em-utils.h" #include "mail-config.h" -#define d(x) +#define d(x) /* Used to cache various data/info for redraws The validity stuff could be cached at a higher level but this is easier @@ -116,7 +116,7 @@ static void emf_init(GObject *o) { EMFormat *emf = (EMFormat *)o; - + emf->inline_table = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, @@ -133,7 +133,7 @@ static void emf_finalise(GObject *o) { EMFormat *emf = (EMFormat *)o; - + if (emf->session) camel_object_unref(emf->session); @@ -146,7 +146,7 @@ emf_finalise(GObject *o) g_string_free(emf->part_id, TRUE); /* FIXME: check pending jobs */ - + ((GObjectClass *)emf_parent)->finalize(o); } @@ -204,7 +204,7 @@ em_format_get_type(void) * em_format_class_add_handler: * @emfc: EMFormatClass * @info: Callback information. - * + * * Add a mime type handler to this class. This is only used by * implementing classes. The @info.old pointer will automatically be * setup to point to the old hanlder if one was already set. This can @@ -227,13 +227,13 @@ em_format_class_add_handler(EMFormatClass *emfc, EMFormatHandler *info) struct _class_handlers { EMFormatClass *old; EMFormatClass *new; -}; +}; static void merge_missing (gpointer key, gpointer value, gpointer userdata) { struct _class_handlers *classes = (struct _class_handlers *) userdata; EMFormatHandler *info, *oldinfo; - + oldinfo = (EMFormatHandler *) value; info = g_hash_table_lookup (classes->new->type_handlers, key); if (!info) { @@ -258,9 +258,9 @@ em_format_merge_handler(EMFormat *new, EMFormat *old) } /** * em_format_class_remove_handler: - * @emfc: - * @info: - * + * @emfc: + * @info: + * * Remove a handler. @info must be a value which was previously * added. **/ @@ -288,11 +288,11 @@ em_format_class_remove_handler(EMFormatClass *emfc, EMFormatHandler *info) /** * em_format_find_handler: - * @emf: - * @mime_type: - * + * @emf: + * @mime_type: + * * Find a format handler by @mime_type. - * + * * Return value: NULL if no handler is available. **/ static const EMFormatHandler * @@ -305,14 +305,14 @@ emf_find_handler(EMFormat *emf, const char *mime_type) /** * em_format_fallback_handler: - * @emf: - * @mime_type: - * + * @emf: + * @mime_type: + * * Try to find a format handler based on the major type of the @mime_type. * * The subtype is replaced with "*" and a lookup performed. - * - * Return value: + * + * Return value: **/ const EMFormatHandler * em_format_fallback_handler(EMFormat *emf, const char *mime_type) @@ -335,18 +335,18 @@ em_format_fallback_handler(EMFormat *emf, const char *mime_type) /** * em_format_add_puri: - * @emf: - * @size: + * @emf: + * @size: * @cid: Override the autogenerated content id. - * @part: - * @func: - * + * @part: + * @func: + * * Add a pending-uri handler. When formatting parts that reference * other parts, a pending-uri (PURI) can be used to track the reference. * * @size is used to allocate the structure, so that it can be directly * subclassed by implementors. - * + * * @cid can be used to override the key used to retreive the PURI, if NULL, * then the content-location and the content-id of the @part are stored * as lookup keys for the part. @@ -427,8 +427,8 @@ em_format_add_puri(EMFormat *emf, size_t size, const char *cid, CamelMimePart *p /** * em_format_push_level: - * @emf: - * + * @emf: + * * This is used to build a heirarchy of visible PURI objects based on * the structure of the message. Used by multipart/alternative formatter. * @@ -455,8 +455,8 @@ em_format_push_level(EMFormat *emf) /** * em_format_pull_level: - * @emf: - * + * @emf: + * * Drop a level of visibility back to the parent. Note that * no PURI values are actually freed. **/ @@ -469,13 +469,13 @@ em_format_pull_level(EMFormat *emf) /** * em_format_find_visible_puri: - * @emf: - * @uri: - * + * @emf: + * @uri: + * * Search for a PURI based on the visibility defined by :push_level() * and :pull_level(). - * - * Return value: + * + * Return value: **/ EMFormatPURI * em_format_find_visible_puri(EMFormat *emf, const char *uri) @@ -502,13 +502,13 @@ em_format_find_visible_puri(EMFormat *emf, const char *uri) /** * em_format_find_puri: - * @emf: - * @uri: - * + * @emf: + * @uri: + * * Search for a PURI based on a uri. Both the content-id * and content-location are checked. - * - * Return value: + * + * Return value: **/ EMFormatPURI * @@ -559,8 +559,8 @@ emf_clear_puri_node(struct _EMFormatPURITree *node) /** * em_format_clear_puri_tree: - * @emf: - * + * @emf: + * * For use by implementors to clear out the message structure * data. **/ @@ -687,7 +687,7 @@ emf_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeM emf->charset = g_strdup(emfsource->charset); g_free (emf->default_charset); emf->default_charset = g_strdup (emfsource->default_charset); - + em_format_clear_headers(emf); for (h = (struct _EMFormatHeader *)emfsource->header_list.head; h->next; h = h->next) em_format_add_header(emf, h->name, h->flags); @@ -765,7 +765,7 @@ emf_busy(EMFormat *emf) * @msg: Camel Message. * @emfsource: Used as a basis for user-altered layout, e.g. inline viewed * attachments. - * + * * Format a message @msg. If @emfsource is non NULL, then the status of * inlined expansion and so forth is copied direction from @emfsource. * @@ -777,9 +777,9 @@ emf_busy(EMFormat *emf) /** * em_format_set_session: - * @emf: - * @s: - * + * @emf: + * @s: + * * Set the CamelSession to be used for signature verification and decryption * purposes. If this is not set, then signatures cannot be verified or * encrypted messages viewed. @@ -796,9 +796,9 @@ em_format_set_session(EMFormat *emf, struct _CamelSession *s) /** * em_format_set_mode: - * @emf: - * @type: - * + * @emf: + * @type: + * * Set display mode, EM_FORMAT_SOURCE, EM_FORMAT_ALLHEADERS, or * EM_FORMAT_NORMAL. **/ @@ -817,9 +817,9 @@ em_format_set_mode(EMFormat *emf, em_format_mode_t type) /** * em_format_set_charset: - * @emf: - * @charset: - * + * @emf: + * @charset: + * * set override charset on formatter. message will be redisplayed if * required. **/ @@ -840,9 +840,9 @@ em_format_set_charset(EMFormat *emf, const char *charset) /** * em_format_set_default_charset: - * @emf: - * @charset: - * + * @emf: + * @charset: + * * Set the fallback, default system charset to use when no other charsets * are present. Message will be redisplayed if required (and sometimes redisplayed * when it isn't). @@ -864,8 +864,8 @@ em_format_set_default_charset(EMFormat *emf, const char *charset) /** * em_format_clear_headers: - * @emf: - * + * @emf: + * * Clear the list of headers to be displayed. This will force all headers to * be shown. **/ @@ -895,8 +895,8 @@ static const struct { /** * em_format_default_headers: - * @emf: - * + * @emf: + * * Set the headers to show to the default list. * * From, Reply-To, To, Cc, Bcc, Subject and Date. @@ -905,7 +905,7 @@ void em_format_default_headers(EMFormat *emf) { int i; - + em_format_clear_headers(emf); for (i=0; i<sizeof(default_headers)/sizeof(default_headers[0]); i++) em_format_add_header(emf, default_headers[i].name, default_headers[i].flags); @@ -913,10 +913,10 @@ em_format_default_headers(EMFormat *emf) /** * em_format_add_header: - * @emf: + * @emf: * @name: The name of the header, as it will appear during output. * @flags: EM_FORMAT_HEAD_* defines to control display attributes. - * + * * Add a specific header to show. If any headers are set, they will * be displayed in the order set by this function. Certain known * headers included in this list will be shown using special @@ -934,9 +934,9 @@ void em_format_add_header(EMFormat *emf, const char *name, guint32 flags) /** * em_format_is_attachment: - * @emf: + * @emf: * @part: Part to check. - * + * * Returns true if the part is an attachment. * * A part is not considered an attachment if it is a @@ -945,7 +945,7 @@ void em_format_add_header(EMFormat *emf, const char *name, guint32 flags) * the part. * * Content-Disposition is not checked. - * + * * Return value: TRUE/FALSE **/ int em_format_is_attachment(EMFormat *emf, CamelMimePart *part) @@ -958,26 +958,26 @@ int em_format_is_attachment(EMFormat *emf, CamelMimePart *part) || camel_content_type_is(dw->mime_type, "application", "x-pkcs7-mime") || camel_content_type_is(dw->mime_type, "application", "pkcs7-mime") || camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-signed") - || camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-encrypted") + || camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-encrypted") || (camel_content_type_is (dw->mime_type, "text", "*") && camel_mime_part_get_filename(part) == NULL)); } /** * em_format_is_inline: - * @emf: - * @part: + * @emf: + * @part: * @partid: format->part_id part id of this part. * @handle: handler for this part - * + * * Returns true if the part should be displayed inline. Any part with * a Content-Disposition of inline, or if the @handle has a default * inline set, will be shown inline. * * :set_inline() called on the same part will override any calculated * value. - * - * Return value: + * + * Return value: **/ int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part, const EMFormatHandler *handle) { @@ -1005,10 +1005,10 @@ int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part, /** * em_format_set_inline: - * @emf: + * @emf: * @partid: id of part - * @state: - * + * @state: + * * Force the attachment @part to be expanded or hidden explictly to match * @state. This is used only to record the change for a redraw or * cloned layout render and does not force a redraw. @@ -1065,10 +1065,10 @@ em_format_format_content(EMFormat *emf, CamelStream *stream, CamelMimePart *part /** * em_format_format_content: - * @emf: + * @emf: * @stream: Where to write the converted text * @part: Part whose container is to be formatted - * + * * Decode/output a part's content to @stream. **/ void @@ -1081,7 +1081,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw) CamelStream *mem_stream = NULL; size_t size; size_t max; - + if (emf->charset) { charset = emf->charset; } else if (dw->mime_type @@ -1097,14 +1097,14 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw) null = camel_stream_null_new(); filter_stream = camel_stream_filter_new_with_stream(null); camel_object_unref(null); - + windows = (CamelMimeFilterWindows *)camel_mime_filter_windows_new(charset); camel_stream_filter_add(filter_stream, (CamelMimeFilter *)windows); - + camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filter_stream); camel_stream_flush((CamelStream *)filter_stream); camel_object_unref(filter_stream); - + charset = camel_mime_filter_windows_real_charset (windows); } else if (charset == NULL) { charset = emf->default_charset; @@ -1112,7 +1112,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw) mem_stream = (CamelStream *)camel_stream_mem_new (); filter_stream = camel_stream_filter_new_with_stream(mem_stream); - + if ((filter = camel_mime_filter_charset_new_convert(charset, "UTF-8"))) { camel_stream_filter_add(filter_stream, (CamelMimeFilter *) filter); camel_object_unref(filter); @@ -1137,13 +1137,13 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw) /** * em_format_describe_part: - * @part: - * @mimetype: - * + * @part: + * @mimetype: + * * Generate a simple textual description of a part, @mime_type represents the * the content. - * - * Return value: + * + * Return value: **/ char * em_format_describe_part(CamelMimePart *part, const char *mime_type) @@ -1249,7 +1249,7 @@ emf_multipart_mixed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con } len = emf->part_id->len; - nparts = camel_multipart_get_number(mp); + nparts = camel_multipart_get_number(mp); for (i = 0; i < nparts; i++) { part = camel_multipart_get_part(mp, i); g_string_append_printf(emf->part_id, ".mixed.%d", i); @@ -1285,7 +1285,7 @@ emf_multipart_alternative(EMFormat *emf, CamelStream *stream, CamelMimePart *par type = camel_mime_part_get_content_type (part); mime_type = camel_content_type_simple (type); - + camel_strdown (mime_type); /*if (want_plain && !strcmp (mime_type, "text/plain")) @@ -1394,7 +1394,7 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c } /* FIXME: put this stuff in a shared function */ - nparts = camel_multipart_get_number(mp); + nparts = camel_multipart_get_number(mp); content_type = camel_mime_part_get_content_type(part); start = camel_content_type_param (content_type, "start"); if (start && strlen(start)>2) { @@ -1404,11 +1404,11 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c /* strip <>'s */ len = strlen (start) - 2; start++; - + for (i=0; i<nparts; i++) { body_part = camel_multipart_get_part(mp, i); cid = camel_mime_part_get_content_id(body_part); - + if (cid && !strncmp(cid, start, len) && strlen(cid) == len) { display_part = body_part; displayid = i; @@ -1418,12 +1418,12 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c } else { display_part = camel_multipart_get_part(mp, 0); } - + if (display_part == NULL) { emf_multipart_mixed(emf, stream, part, info); return; } - + em_format_push_level(emf); oldpartid = g_strdup(emf->part_id->str); @@ -1440,7 +1440,7 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c d(printf(" part '%s' '%s' added\n", puri->uri?puri->uri:"", puri->cid)); } } - + g_string_append_printf(emf->part_id, ".related.%d", displayid); em_format_part(emf, stream, display_part); g_string_truncate(emf->part_id, partidlen); @@ -1550,7 +1550,7 @@ emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons handle = em_format_find_handler(emf, "x-evolution/message/rfc822"); if (handle) handle->handler(emf, stream, (CamelMimePart *)dw, handle); - + g_string_truncate(emf->part_id, len); } @@ -1593,67 +1593,67 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E camel_object_unref(cipher); return; } - + /* Setup output stream */ ostream = camel_stream_mem_new(); filtered_stream = camel_stream_filter_new_with_stream(ostream); - + /* Add PGP header / footer filter */ pgp_filter = (CamelMimeFilterPgp *)camel_mime_filter_pgp_new(); camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)pgp_filter); camel_object_unref(pgp_filter); - + /* Pass through the filters that have been setup */ dw = camel_medium_get_content_object((CamelMedium *)ipart); camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filtered_stream); camel_stream_flush((CamelStream *)filtered_stream); camel_object_unref(filtered_stream); - + /* Create a new text/plain MIME part containing the signed content preserving the original part's Content-Type params */ content_type = camel_mime_part_get_content_type (ipart); type = camel_content_type_format (content_type); content_type = camel_content_type_decode (type); g_free (type); - + g_free (content_type->type); content_type->type = g_strdup ("text"); g_free (content_type->subtype); content_type->subtype = g_strdup ("plain"); type = camel_content_type_format (content_type); camel_content_type_unref (content_type); - + dw = camel_data_wrapper_new (); camel_data_wrapper_construct_from_stream (dw, ostream); camel_data_wrapper_set_mime_type (dw, type); - + opart = camel_mime_part_new (); camel_medium_set_content_object ((CamelMedium *) opart, dw); camel_data_wrapper_set_mime_type_field ((CamelDataWrapper *) opart, dw->mime_type); - - /* Pass it off to the real formatter */ + + /* Pass it off to the real formatter */ em_format_format_secure(emf, stream, opart, valid); - + /* Clean Up */ camel_object_unref(dw); camel_object_unref(opart); camel_object_unref(ostream); camel_object_unref(cipher); - camel_exception_free(ex); + camel_exception_free(ex); } static void emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, EMFormatHandler *info) -{ +{ CamelCipherContext *cipher; CamelCipherValidity *valid; CamelException *ex; CamelMimePart *opart; - + cipher = camel_gpg_context_new(emf->session); ex = camel_exception_new(); opart = camel_mime_part_new(); /* Decrypt the message */ - valid = camel_cipher_decrypt (cipher, ipart, opart, ex); + valid = camel_cipher_decrypt (cipher, ipart, opart, ex); if (!valid) { em_format_format_error(emf, stream, ex->desc?_("Could not parse PGP message"):_("Could not parse PGP message: Unknown error")); if (ex->desc) @@ -1666,7 +1666,7 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart return; } - /* Pass it off to the real formatter */ + /* Pass it off to the real formatter */ em_format_format_secure(emf, stream, opart, valid); /* Clean Up */ diff --git a/mail/em-format.h b/mail/em-format.h index 81f4b5c508..6dba5f8b05 100644 --- a/mail/em-format.h +++ b/mail/em-format.h @@ -55,13 +55,13 @@ typedef enum _em_format_mode_t { /** * struct _EMFormatHandler - MIME type handler. - * + * * @mime_type: Type this handler handles. * @handler: The handler callback. * @flags: Handling flags, see enum _em_format_handler_t. * @old: The last handler set on this type. Allows overrides to * fallback to previous implementation. - * + * **/ struct _EMFormatHandler { char *mime_type; @@ -73,12 +73,12 @@ struct _EMFormatHandler { /** * enum _em_format_handler_t - Format handler flags. - * + * * @EM_FORMAT_HANDLER_INLINE: This type should be shown expanded * inline by default. * @EM_FORMAT_HANDLER_INLINE_DISPOSITION: This type should always be * shown inline, despite what the Content-Disposition suggests. - * + * **/ enum _em_format_handler_t { EM_FORMAT_HANDLER_INLINE = 1<<0, @@ -91,11 +91,11 @@ typedef void (*EMFormatPURIFunc)(EMFormat *md, struct _CamelStream *stream, EMFo /** * struct _EMFormatPURI - Pending URI object. - * + * * @next: Double-linked list header. * @prev: Double-linked list header. * @free: May be set by allocator and will be called when no longer needed. - * @format: + * @format: * @uri: Calculated URI of the part, if the part has one in its * Content-Location field. * @cid: The RFC2046 Content-Id of the part. If none is present, a unique value @@ -103,9 +103,9 @@ typedef void (*EMFormatPURIFunc)(EMFormat *md, struct _CamelStream *stream, EMFo * @part_id: A unique identifier for each part. * @func: Callback for when the URI is requested. The callback writes * its data to the supplied stream. - * @part: - * @use_count: - * + * @part: + * @use_count: + * * This is used for multipart/related, and other formatters which may * need to include a reference to out-of-band data in the content * stream. @@ -131,7 +131,7 @@ struct _EMFormatPURI { /** * struct _EMFormatPURITree - Pending URI visibility tree. - * + * * @next: Double-linked list header. * @prev: Double-linked list header. * @parent: Parent in tree. @@ -163,27 +163,27 @@ struct _EMFormatHeader { /** * struct _EMFormat - Mail formatter object. - * - * @parent: - * @priv: - * @message: - * @folder: - * @uid: - * @part_id: - * @header_list: - * @session: - * @base url: - * @snoop_mime_type: - * @valid: - * @valid_parent: - * @inline_table: - * @pending_uri_table: - * @pending_uri_tree: - * @pending_uri_level: - * @mode: - * @charset: - * @default_charset: - * + * + * @parent: + * @priv: + * @message: + * @folder: + * @uid: + * @part_id: + * @header_list: + * @session: + * @base url: + * @snoop_mime_type: + * @valid: + * @valid_parent: + * @inline_table: + * @pending_uri_table: + * @pending_uri_tree: + * @pending_uri_level: + * @mode: + * @charset: + * @default_charset: + * * Most fields are private or read-only. * * This is the base MIME formatter class. It provides no formatting @@ -191,9 +191,9 @@ struct _EMFormatHeader { **/ struct _EMFormat { GObject parent; - + struct _EMFormatPrivate *priv; - + struct _CamelMimeMessage *message; /* the current message */ struct _CamelFolder *folder; @@ -262,7 +262,7 @@ struct _EMFormatClass { /* Shows optional way to open messages */ void (*format_optional)(EMFormat *, struct _CamelStream *, struct _CamelMimePart *, struct _CamelStream* ); - + /* signals */ /* complete, alternative to polling busy, for asynchronous work */ void (*complete)(EMFormat *); diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c index 5738d6f56c..7b54dbe887 100644 --- a/mail/em-html-stream.c +++ b/mail/em-html-stream.c @@ -31,7 +31,7 @@ #include <gtk/gtkmain.h> #include "em-html-stream.h" -#define d(x) +#define d(x) static void em_html_stream_class_init (EMHTMLStreamClass *klass); static void em_html_stream_init (CamelObject *object); @@ -47,7 +47,7 @@ CamelType em_html_stream_get_type (void) { static CamelType type = CAMEL_INVALID_TYPE; - + if (type == CAMEL_INVALID_TYPE) { parent_class = (EMSyncStreamClass *)em_sync_stream_get_type(); type = camel_type_register (em_sync_stream_get_type(), @@ -59,7 +59,7 @@ em_html_stream_get_type (void) (CamelObjectInitFunc) em_html_stream_init, (CamelObjectFinalizeFunc) em_html_stream_finalize); } - + return type; } @@ -156,7 +156,7 @@ CamelStream * em_html_stream_new(struct _GtkHTML *html, struct _GtkHTMLStream *html_stream) { EMHTMLStream *new; - + new = EM_HTML_STREAM (camel_object_new (EM_HTML_STREAM_TYPE)); new->html_stream = html_stream; new->html = html; diff --git a/mail/em-html-stream.h b/mail/em-html-stream.h index ad3ee0ac0b..e8be92eb9b 100644 --- a/mail/em-html-stream.h +++ b/mail/em-html-stream.h @@ -49,7 +49,7 @@ typedef struct _EMHTMLStream { typedef struct { EMSyncStreamClass parent_class; - + } EMHTMLStreamClass; diff --git a/mail/em-icon-stream.c b/mail/em-icon-stream.c index 3407eb817e..ebd2cf6cc1 100644 --- a/mail/em-icon-stream.c +++ b/mail/em-icon-stream.c @@ -38,7 +38,7 @@ #include "libedataserver/e-msgport.h" -#define d(x) +#define d(x) /* fixed-point scale factor for scaled images in cache */ #define EMIS_SCALE (1024) @@ -72,7 +72,7 @@ CamelType em_icon_stream_get_type (void) { static CamelType type = CAMEL_INVALID_TYPE; - + if (type == CAMEL_INVALID_TYPE) { parent_class = (EMSyncStreamClass *)em_sync_stream_get_type(); type = camel_type_register (em_sync_stream_get_type(), @@ -86,7 +86,7 @@ em_icon_stream_get_type (void) emis_cache = em_cache_new(60, sizeof(struct _emis_cache_node), emis_cache_free); } - + return type; } @@ -274,7 +274,7 @@ em_icon_stream_get_image(const char *key, unsigned int maxwidth, unsigned int ma GdkPixbuf *pb = NULL; /* forces the cache to be setup if not */ - em_icon_stream_get_type(); + em_icon_stream_get_type(); node = (struct _emis_cache_node *)em_cache_lookup(emis_cache, key); if (node) { @@ -326,7 +326,7 @@ em_icon_stream_is_resized(const char *key, unsigned int maxwidth, unsigned int m { int res = FALSE; struct _emis_cache_node *node; - + /* forces the cache to be setup if not */ em_icon_stream_get_type(); diff --git a/mail/em-inline-filter.c b/mail/em-inline-filter.c index 79300b33bc..59075ef5d3 100644 --- a/mail/em-inline-filter.c +++ b/mail/em-inline-filter.c @@ -33,7 +33,7 @@ #include "em-utils.h" -#define d(x) +#define d(x) static void em_inline_filter_class_init (EMInlineFilterClass *klass); static void em_inline_filter_init (CamelObject *object); @@ -49,7 +49,7 @@ CamelType em_inline_filter_get_type (void) { static CamelType type = CAMEL_INVALID_TYPE; - + if (type == CAMEL_INVALID_TYPE) { parent_class = (CamelMimeFilterClass *)camel_mime_filter_get_type(); @@ -62,7 +62,7 @@ em_inline_filter_get_type (void) (CamelObjectInitFunc) em_inline_filter_init, (CamelObjectFinalizeFunc) em_inline_filter_finalize); } - + return type; } @@ -129,7 +129,7 @@ emif_add_part(EMInlineFilter *emif, const char *data, int len) CamelMimePart *part; CamelStream *mem; char *type; - + if (emif->state == EMIF_PLAIN || emif->state == EMIF_PGPSIGNED || emif->state == EMIF_PGPENCRYPTED) encoding = emif->base_encoding; else @@ -142,11 +142,11 @@ emif_add_part(EMInlineFilter *emif, const char *data, int len) } mem = camel_stream_mem_new_with_byte_array(emif->data); emif->data = g_byte_array_new(); - + dw = camel_data_wrapper_new(); camel_data_wrapper_construct_from_stream(dw, mem); camel_object_unref(mem); - + if (emif_types[emif->state].plain && emif->base_type) { camel_content_type_ref (emif->base_type); content_type = emif->base_type; @@ -155,17 +155,17 @@ emif_add_part(EMInlineFilter *emif, const char *data, int len) type = camel_content_type_format (emif->base_type); content_type = camel_content_type_decode (type); g_free (type); - + g_free (content_type->type); g_free (content_type->subtype); content_type->type = g_strdup (emif_types[emif->state].type); content_type->subtype = g_strdup (emif_types[emif->state].subtype); } - + camel_data_wrapper_set_mime_type_field (dw, content_type); camel_content_type_unref (content_type); dw->encoding = encoding; - + part = camel_mime_part_new(); camel_medium_set_content_object((CamelMedium *)part, dw); camel_mime_part_set_encoding(part, encoding); @@ -203,7 +203,7 @@ emif_scan(CamelMimeFilter *f, char *in, size_t len, int final) while (inptr < inend && *inptr != '\n') inptr++; - + if (inptr == inend) { if (!final) { camel_mime_filter_backup(f, start, inend-start); @@ -378,12 +378,12 @@ emif_reset(CamelMimeFilter *f) * raw data being processed. * @base_type: The base content-type of the raw data, should always be * text/plain. - * + * * Create a filter which will scan a (text) stream for * embedded parts. You can then retrieve the contents * as a CamelMultipart object. - * - * Return value: + * + * Return value: **/ EMInlineFilter * em_inline_filter_new(CamelTransferEncoding base_encoding, CamelContentType *base_type) diff --git a/mail/em-junk-hook.c b/mail/em-junk-hook.c index 7c081fcf94..ee4a6ed614 100644 --- a/mail/em-junk-hook.c +++ b/mail/em-junk-hook.c @@ -64,11 +64,11 @@ static const EPluginHookTargetKey emjh_flag_map[] = { static const char * em_junk_get_name (CamelJunkPlugin *csp); -static void +static void em_junk_init(CamelJunkPlugin *csp) { struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - + ((EPluginClass *)G_OBJECT_GET_CLASS(item->hook->hook.plugin))->enable(item->hook->hook.plugin, 1); } @@ -84,7 +84,7 @@ em_junk_get_name (CamelJunkPlugin *csp) } -static gboolean +static gboolean em_junk_check_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) { struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; @@ -100,7 +100,7 @@ em_junk_check_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) return FALSE; } -static void +static void em_junk_report_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) { struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; @@ -114,7 +114,7 @@ em_junk_report_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) } } -static void +static void em_junk_report_non_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) { struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; @@ -127,24 +127,24 @@ em_junk_report_non_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) } } -static void +static void em_junk_commit_reports(CamelJunkPlugin *csp) { struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - if (item->hook && item->hook->hook.plugin->enabled) + if (item->hook && item->hook->hook.plugin->enabled) e_plugin_invoke(item->hook->hook.plugin, item->commit_reports, NULL); } -static void +static void emj_dispose (GObject *object) { if (parent_class->dispose) parent_class->dispose (object); } -static void +static void emj_finalize (GObject *object) { if (parent_class->finalize) @@ -174,7 +174,7 @@ emjh_free_group(EMJunkHookGroup *group) static struct _EMJunkHookItem * emjh_construct_item(EPluginHook *eph, EMJunkHookGroup *group, xmlNodePtr root) { - struct _EMJunkHookItem *item; + struct _EMJunkHookItem *item; CamelJunkPlugin junk_plugin = { em_junk_get_name, 1, @@ -193,16 +193,16 @@ emjh_construct_item(EPluginHook *eph, EMJunkHookGroup *group, xmlNodePtr root) item->report_non_junk = e_plugin_xml_prop(root, "report_non_junk"); item->commit_reports = e_plugin_xml_prop(root, "commit_reports"); item->validate_binary = e_plugin_xml_prop(root, "validate_binary"); - + item->plugin_name = e_plugin_xml_prop(root, "name"); item->hook = emjh; - + if (item->check_junk == NULL || item->report_junk == NULL || item->report_non_junk == NULL || item->commit_reports == NULL) goto error; - + /* Add the plugin to the session plugin list*/ mail_session_add_junk_plugin (item->plugin_name, CAMEL_JUNK_PLUGIN (&(item->csp))); - + return item; error: printf ("ERROR"); @@ -224,7 +224,7 @@ emjh_construct_group(EPluginHook *eph, xmlNodePtr root) goto error; node = root->children; - + /* We'll processs only the first item from xml file*/ while (node) { if (0 == strcmp((char *)node->name, "item")) { @@ -235,14 +235,14 @@ emjh_construct_group(EPluginHook *eph, xmlNodePtr root) group->items = g_slist_append(group->items, item); break; } - + node = node->next; } return group; error: emjh_free_group(group); - + return NULL; } @@ -250,7 +250,7 @@ static int emjh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) { xmlNodePtr node; - + d(printf("loading junk hook\n")); if (((EPluginHookClass *)emjh_parent_class)->construct(eph, ep, root) == -1) @@ -273,7 +273,7 @@ emjh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) } node = node->next; } - + eph->plugin = ep; return 0; @@ -284,7 +284,7 @@ static void emjh_enable(EPluginHook *eph, int state) { GSList *g; - + g = emjh->groups; if (emjh_types == NULL) return; @@ -315,7 +315,7 @@ GType em_junk_hook_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMJunkHookClass), NULL, NULL, (GClassInitFunc) emjh_class_init, NULL, NULL, @@ -325,7 +325,7 @@ em_junk_hook_get_type(void) emjh_parent_class = g_type_class_ref(e_plugin_hook_get_type()); type = g_type_register_static(e_plugin_hook_get_type(), "EMJunkHook", &info, 0); } - + return type; } @@ -342,7 +342,7 @@ GType emj_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMJunkClass), NULL, NULL, (GClassInitFunc) emj_class_init, NULL, NULL, @@ -352,11 +352,11 @@ emj_get_type(void) emj_parent = g_type_class_ref(G_TYPE_OBJECT); type = g_type_register_static(G_TYPE_OBJECT, "EMJunk", &info, 0); } - + return type; } -void +void em_junk_hook_register_type(GType type) { EMJunk *klass; diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c index a47f274e5b..9746e620bb 100644 --- a/mail/em-mailer-prefs.c +++ b/mail/em-mailer-prefs.c @@ -72,7 +72,7 @@ enum { HEADER_LIST_ENABLED_COLUMN, /* is the header enabled? */ HEADER_LIST_IS_DEFAULT_COLUMN, /* is this header a default header, eg From: */ HEADER_LIST_HEADER_COLUMN, /* the real name of this header */ - HEADER_LIST_N_COLUMNS, + HEADER_LIST_N_COLUMNS, }; static GType col_types[] = { @@ -91,7 +91,7 @@ static const char *default_headers[] = { N_("Bcc"), N_("Subject"), N_("Date"), - N_("Newsgroups"), + N_("Newsgroups"), "x-evolution-mailer", /* DO NOT translate */ }; @@ -112,7 +112,7 @@ GtkType em_mailer_prefs_get_type (void) { static GType type = 0; - + if (!type) { GTypeInfo type_info = { sizeof (EMMailerPrefsClass), @@ -123,10 +123,10 @@ em_mailer_prefs_get_type (void) 0, (GInstanceInitFunc) em_mailer_prefs_init, }; - + type = g_type_register_static (gtk_vbox_get_type (), "EMMailerPrefs", &type_info, 0); } - + return type; } @@ -134,10 +134,10 @@ static void em_mailer_prefs_class_init (EMMailerPrefsClass *klass) { GObjectClass *object_class; - + object_class = (GObjectClass *) klass; parent_class = g_type_class_ref (gtk_vbox_get_type ()); - + object_class->finalize = em_mailer_prefs_finalise; } @@ -151,9 +151,9 @@ static void em_mailer_prefs_finalise (GObject *obj) { EMMailerPrefs *prefs = (EMMailerPrefs *) obj; - + g_object_unref (prefs->gui); - + ((GObjectClass *)(parent_class))->finalize (obj); } @@ -189,7 +189,7 @@ labels_changed (EMMailerPrefs *prefs) const char *cstring; char *string; int i; - + for (i = 4; i >= 0; i--) { GdkColor color; @@ -199,9 +199,9 @@ labels_changed (EMMailerPrefs *prefs) color.red, color.green, color.blue); list = g_slist_prepend (list, string); } - + gconf_client_set_list (prefs->gconf, "/apps/evolution/mail/labels", GCONF_VALUE_STRING, list, NULL); - + l = list; while (l != NULL) { n = l->next; @@ -228,7 +228,7 @@ restore_labels_clicked (GtkWidget *widget, gpointer user_data) { EMMailerPrefs *prefs = (EMMailerPrefs *) user_data; int i; - + for (i = 0; i < 5; i++) { gtk_entry_set_text (prefs->labels[i].name, _(label_defaults[i].name)); color_button_set_color (prefs->labels[i].color, label_defaults[i].colour); @@ -243,13 +243,13 @@ emmp_header_remove_sensitivity (EMMailerPrefs *prefs) GtkTreeSelection *selection = gtk_tree_view_get_selection (prefs->header_list); gboolean is_default; - /* remove button should be sensitive if the currenlty selected entry in the list view - is not a default header. if there are no entries, or none is selected, it should be + /* remove button should be sensitive if the currenlty selected entry in the list view + is not a default header. if there are no entries, or none is selected, it should be disabled */ if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { - gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter, - HEADER_LIST_IS_DEFAULT_COLUMN, &is_default, + gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter, + HEADER_LIST_IS_DEFAULT_COLUMN, &is_default, -1); if (is_default) gtk_widget_set_sensitive (GTK_WIDGET (prefs->remove_header), FALSE); @@ -264,16 +264,16 @@ static gboolean emmp_header_is_valid (const char *header) { const char *p = header; - + if (header[0] == 0) return FALSE; - + while (*p) { if ((*p == ':') || (*p == ' ')) return FALSE; p++; } - + return TRUE; } @@ -283,9 +283,9 @@ emmp_header_add_sensitivity (EMMailerPrefs *prefs) const char *entry_contents; GtkTreeIter iter; gboolean valid; - - /* the add header button should be sensitive if the text box contains - a valid header string, that is not a duplicate with something already + + /* the add header button should be sensitive if the text box contains + a valid header string, that is not a duplicate with something already in the list view */ entry_contents = gtk_entry_get_text (GTK_ENTRY (prefs->entry_header)); @@ -293,23 +293,23 @@ emmp_header_add_sensitivity (EMMailerPrefs *prefs) gtk_widget_set_sensitive (GTK_WIDGET (prefs->add_header), FALSE); return; } - + /* check if this is a duplicate */ valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (prefs->header_list_store), &iter); while (valid) { char *header_name; - - gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter, - HEADER_LIST_HEADER_COLUMN, &header_name, + + gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter, + HEADER_LIST_HEADER_COLUMN, &header_name, -1); if (g_ascii_strcasecmp (header_name, entry_contents) == 0) { gtk_widget_set_sensitive (GTK_WIDGET (prefs->add_header), FALSE); return; } - + valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (prefs->header_list_store), &iter); } - + gtk_widget_set_sensitive (GTK_WIDGET (prefs->add_header), TRUE); } @@ -319,7 +319,7 @@ emmp_save_headers (EMMailerPrefs *prefs) GSList *header_list; GtkTreeIter iter; gboolean valid; - + /* Headers */ header_list = NULL; valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (prefs->header_list_store), &iter); @@ -327,19 +327,19 @@ emmp_save_headers (EMMailerPrefs *prefs) struct _EMMailerPrefsHeader h; gboolean enabled; char *xml; - - gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter, - HEADER_LIST_HEADER_COLUMN, &h.name, - HEADER_LIST_ENABLED_COLUMN, &enabled, + + gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter, + HEADER_LIST_HEADER_COLUMN, &h.name, + HEADER_LIST_ENABLED_COLUMN, &enabled, -1); h.enabled = enabled; - + if ((xml = em_mailer_prefs_header_to_xml (&h))) header_list = g_slist_append (header_list, xml); - + valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (prefs->header_list_store), &iter); } - + gconf_client_set_list (prefs->gconf, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, header_list, NULL); g_slist_foreach (header_list, (GFunc) g_free, NULL); g_slist_free (header_list); @@ -352,14 +352,14 @@ emmp_header_list_enabled_toggled (GtkCellRendererToggle *cell, const char *path_ GtkTreePath *path = gtk_tree_path_new_from_string (path_string); GtkTreeIter iter; int enabled; - + gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, HEADER_LIST_ENABLED_COLUMN, &enabled, -1); enabled = !enabled; gtk_list_store_set (GTK_LIST_STORE (model), &iter, HEADER_LIST_ENABLED_COLUMN, enabled, -1); gtk_tree_path_free (path); - + emmp_save_headers (prefs); } @@ -369,16 +369,16 @@ emmp_header_add_header (GtkWidget *widget, EMMailerPrefs *prefs) GtkTreeModel *model = GTK_TREE_MODEL (prefs->header_list_store); GtkTreeIter iter; const gchar *text = gtk_entry_get_text (prefs->entry_header); - + g_strstrip ((gchar *)text); if (text && (strlen (text)>0)) { gtk_list_store_append (GTK_LIST_STORE (model), &iter); - gtk_list_store_set (GTK_LIST_STORE (model), &iter, - HEADER_LIST_NAME_COLUMN, text, - HEADER_LIST_ENABLED_COLUMN, TRUE, - HEADER_LIST_HEADER_COLUMN, text, - HEADER_LIST_IS_DEFAULT_COLUMN, FALSE, + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + HEADER_LIST_NAME_COLUMN, text, + HEADER_LIST_ENABLED_COLUMN, TRUE, + HEADER_LIST_HEADER_COLUMN, text, + HEADER_LIST_IS_DEFAULT_COLUMN, FALSE, -1); gtk_entry_set_text (prefs->entry_header, ""); emmp_header_remove_sensitivity (prefs); @@ -395,21 +395,21 @@ emmp_header_remove_header (GtkWidget *button, gpointer user_data) GtkTreeModel *model = GTK_TREE_MODEL (prefs->header_list_store); GtkTreeSelection *selection = gtk_tree_view_get_selection (prefs->header_list); GtkTreeIter iter; - + if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) return; - + gtk_list_store_remove (GTK_LIST_STORE (model), &iter); emmp_header_remove_sensitivity (prefs); - + emmp_save_headers (prefs); } -static void +static void emmp_header_list_row_selected (GtkTreeSelection *selection, gpointer user_data) { EMMailerPrefs *prefs = (EMMailerPrefs *) user_data; - + emmp_header_remove_sensitivity (prefs); } @@ -417,7 +417,7 @@ static void emmp_header_entry_changed (GtkWidget *entry, gpointer user_data) { EMMailerPrefs *prefs = (EMMailerPrefs *) user_data; - + emmp_header_add_sensitivity (prefs); } @@ -425,7 +425,7 @@ static void mark_seen_timeout_changed (GtkSpinButton *spin, EMMailerPrefs *prefs) { int timeout; - + timeout = (int) (gtk_spin_button_get_value (prefs->timeout) * 1000.0); gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/mark_seen_timeout", timeout, NULL); } @@ -434,9 +434,9 @@ static void address_compress_count_changed (GtkSpinButton *spin, EMMailerPrefs *prefs) { int count; - + count = (int) gtk_spin_button_get_value (prefs->address_count); - + gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/address_count", count, NULL); } @@ -444,9 +444,9 @@ static void mlimit_count_changed (GtkSpinButton *spin, EMMailerPrefs *prefs) { int count; - + count = (int) gtk_spin_button_get_value (prefs->mlimit_count); - + gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/message_text_part_limit", count, NULL); } @@ -457,13 +457,13 @@ spin_button_init (EMMailerPrefs *prefs, GtkSpinButton *spin, const char *key, fl double min, max; char *mkey, *p; int val; - + gtk_spin_button_get_range (spin, &min, &max); - + mkey = g_alloca (strlen (key) + 5); p = g_stpcpy (mkey, key); *p++ = '_'; - + /* see if the admin locked down the min value */ strcpy (p, "min"); val = gconf_client_get_int (prefs->gconf, mkey, &err); @@ -471,7 +471,7 @@ spin_button_init (EMMailerPrefs *prefs, GtkSpinButton *spin, const char *key, fl g_clear_error (&err); else min = (1.0 * val) / div; - + /* see if the admin locked down the max value */ strcpy (p, "max"); val = gconf_client_get_int (prefs->gconf, mkey, &err); @@ -479,18 +479,18 @@ spin_button_init (EMMailerPrefs *prefs, GtkSpinButton *spin, const char *key, fl g_clear_error (&err); else max = (1.0 * val) / div; - + gtk_spin_button_set_range (spin, min, max); - + /* get the value */ val = gconf_client_get_int (prefs->gconf, key, NULL); gtk_spin_button_set_value (spin, (1.0 * val) / div); - + if (value_changed) { g_object_set_data ((GObject *) spin, "key", (void *) key); g_signal_connect (spin, "value-changed", value_changed, prefs); } - + if (!gconf_client_key_is_writable (prefs->gconf, key, NULL)) gtk_widget_set_sensitive ((GtkWidget *) spin, FALSE); } @@ -499,7 +499,7 @@ static void toggle_button_toggled (GtkToggleButton *toggle, EMMailerPrefs *prefs) { const char *key; - + key = g_object_get_data ((GObject *) toggle, "key"); gconf_client_set_bool (prefs->gconf, key, gtk_toggle_button_get_active (toggle), NULL); } @@ -520,7 +520,7 @@ static void toggle_button_toggled_not (GtkToggleButton *toggle, EMMailerPrefs *prefs) { const char *key; - + key = g_object_get_data ((GObject *) toggle, "key"); gconf_client_set_bool (prefs->gconf, key, !gtk_toggle_button_get_active (toggle), NULL); } @@ -530,12 +530,12 @@ static void custom_font_changed (GtkToggleButton *toggle, EMMailerPrefs *prefs) { gboolean use_custom; - + use_custom = !gtk_toggle_button_get_active (toggle); - + gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_fixed), use_custom); gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_variable), use_custom); - + gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/fonts/use_custom", use_custom, NULL); } @@ -544,7 +544,7 @@ font_changed (GtkFontButton *font_button, EMMailerPrefs *prefs) { const gchar *key; const gchar *font_name; - + key = g_object_get_data (G_OBJECT (font_button), "key"); font_name = gtk_font_button_get_font_name (font_button); gconf_client_set_string (prefs->gconf, key, font_name, NULL); @@ -554,7 +554,7 @@ static void toggle_button_init (EMMailerPrefs *prefs, GtkToggleButton *toggle, int not, const char *key, GCallback toggled) { gboolean bool; - + bool = gconf_client_get_bool (prefs->gconf, key, NULL); gtk_toggle_button_set_active (toggle, not ? !bool : bool); @@ -562,7 +562,7 @@ toggle_button_init (EMMailerPrefs *prefs, GtkToggleButton *toggle, int not, cons g_object_set_data ((GObject *) toggle, "key", (void *) key); g_signal_connect (toggle, "toggled", toggled, prefs); } - + if (!gconf_client_key_is_writable (prefs->gconf, key, NULL)) gtk_widget_set_sensitive ((GtkWidget *) toggle, FALSE); } @@ -572,11 +572,11 @@ charset_activate (GtkWidget *item, EMMailerPrefs *prefs) { GtkWidget *menu; char *string; - + menu = gtk_option_menu_get_menu (prefs->charset); if (!(string = e_charset_picker_get_charset (menu))) string = g_strdup (e_iconv_locale_charset ()); - + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/charset", string, NULL); g_free (string); } @@ -587,19 +587,19 @@ charset_menu_init (EMMailerPrefs *prefs) GtkWidget *menu, *item; GList *items; char *buf; - + buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/charset", NULL); menu = e_charset_picker_new (buf && *buf ? buf : e_iconv_locale_charset ()); gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu)); g_free (buf); - + items = GTK_MENU_SHELL (menu)->children; while (items) { item = items->data; g_signal_connect (item, "activate", G_CALLBACK (charset_activate), prefs); items = items->next; } - + if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/charset", NULL)) gtk_widget_set_sensitive ((GtkWidget *) prefs->charset, FALSE); } @@ -608,7 +608,7 @@ static void trash_days_activate (GtkWidget *item, EMMailerPrefs *prefs) { int days; - + days = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "days")); gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", days, NULL); } @@ -618,29 +618,29 @@ emmp_empty_trash_init (EMMailerPrefs *prefs) { int locked, days, hist = 0, i; GtkWidget *menu, *item; - + toggle_button_init (prefs, prefs->empty_trash, FALSE, "/apps/evolution/mail/trash/empty_on_exit", G_CALLBACK (toggle_button_toggled)); - + days = gconf_client_get_int(prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL); menu = gtk_menu_new(); for (i = 0; i < G_N_ELEMENTS (empty_trash_frequency); i++) { if (days >= empty_trash_frequency[i].days) hist = i; - + item = gtk_menu_item_new_with_label (_(empty_trash_frequency[i].label)); g_object_set_data ((GObject *) item, "days", GINT_TO_POINTER (empty_trash_frequency[i].days)); g_signal_connect (item, "activate", G_CALLBACK (trash_days_activate), prefs); - + gtk_widget_show (item); gtk_menu_shell_append((GtkMenuShell *)menu, item); } - + gtk_widget_show(menu); gtk_option_menu_set_menu((GtkOptionMenu *)prefs->empty_trash_days, menu); gtk_option_menu_set_history((GtkOptionMenu *)prefs->empty_trash_days, hist); - + locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL); gtk_widget_set_sensitive ((GtkWidget *) prefs->empty_trash_days, !locked); } @@ -649,7 +649,7 @@ static void junk_days_activate (GtkWidget *item, EMMailerPrefs *prefs) { int days; - + days = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "days")); gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", days, NULL); } @@ -659,29 +659,29 @@ emmp_empty_junk_init (EMMailerPrefs *prefs) { int locked, days, hist = 0, i; GtkWidget *menu, *item; - + toggle_button_init (prefs, prefs->empty_junk, FALSE, "/apps/evolution/mail/junk/empty_on_exit", G_CALLBACK (toggle_button_toggled)); - + days = gconf_client_get_int(prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL); menu = gtk_menu_new(); for (i = 0; i < G_N_ELEMENTS (empty_trash_frequency); i++) { if (days >= empty_trash_frequency[i].days) hist = i; - + item = gtk_menu_item_new_with_label (_(empty_trash_frequency[i].label)); g_object_set_data ((GObject *) item, "days", GINT_TO_POINTER (empty_trash_frequency[i].days)); g_signal_connect (item, "activate", G_CALLBACK (junk_days_activate), prefs); - + gtk_widget_show (item); gtk_menu_shell_append((GtkMenuShell *)menu, item); } - + gtk_widget_show(menu); gtk_option_menu_set_menu((GtkOptionMenu *)prefs->empty_junk_days, menu); gtk_option_menu_set_history((GtkOptionMenu *)prefs->empty_junk_days, hist); - + locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL); gtk_widget_set_sensitive ((GtkWidget *) prefs->empty_junk_days, !locked); } @@ -690,14 +690,14 @@ static void http_images_changed (GtkWidget *widget, EMMailerPrefs *prefs) { int when; - + if (gtk_toggle_button_get_active (prefs->images_always)) when = MAIL_CONFIG_HTTP_ALWAYS; else if (gtk_toggle_button_get_active (prefs->images_sometimes)) when = MAIL_CONFIG_HTTP_SOMETIMES; else when = MAIL_CONFIG_HTTP_NEVER; - + gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", when, NULL); } @@ -706,7 +706,7 @@ static void notify_type_changed (GtkWidget *widget, EMMailerPrefs *prefs) { int type; - + if (gtk_toggle_button_get_active (prefs->notify_not)) type = MAIL_CONFIG_NOTIFY_NOT; else if (gtk_toggle_button_get_active (prefs->notify_beep)) @@ -773,7 +773,7 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs) { char *def_plugin = gtk_combo_box_get_active_text(GTK_COMBO_BOX (combo)); const GList *plugins = mail_session_get_junk_plugins(); - + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", def_plugin, NULL); while (plugins) { struct _EMJunkHookItem *item = plugins->data;; @@ -798,8 +798,8 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs) html = g_strdup_printf ("<i>%s</i>", text); gtk_label_set_markup (prefs->plugin_status, html); g_free (html); - g_free (text); - } + g_free (text); + } break; } plugins = plugins->next; @@ -816,30 +816,30 @@ junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs) if (!plugins || !g_list_length ((GList *)plugins)) { gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("No Junk plugin available")); - gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE); gtk_widget_hide (GTK_WIDGET (prefs->plugin_image)); gtk_widget_hide (GTK_WIDGET (prefs->plugin_status)); gtk_image_set_from_stock (prefs->plugin_image, NULL, 0); g_free (pdefault); - + return; } - + while (plugins) { struct _EMJunkHookItem *item = plugins->data;; - + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), item->plugin_name); if (!def_set && pdefault && item->plugin_name && !strcmp(pdefault, item->plugin_name)) { gboolean status; - + def_set = TRUE; gtk_combo_box_set_active (GTK_COMBO_BOX (combo), index); status = e_plugin_invoke (item->hook->hook.plugin, item->validate_binary, NULL) != NULL; if (status) { char *text, *html; gtk_image_set_from_stock (prefs->plugin_image, "gtk-dialog-info", GTK_ICON_SIZE_MENU); - /* May be a better text */ + /* May be a better text */ text = g_strdup_printf (_("%s plugin is available and the binary is installed."), item->plugin_name); html = g_strdup_printf ("<i>%s</i>", text); gtk_label_set_markup (prefs->plugin_status, html); @@ -853,7 +853,7 @@ junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs) html = g_strdup_printf ("<i>%s</i>", text); gtk_label_set_markup (prefs->plugin_status, html); g_free (html); - g_free (text); + g_free (text); } } plugins = plugins->next; @@ -868,7 +868,7 @@ GtkWidget * create_combo_text_widget (void) { return gtk_combo_box_new_text (); } - + static void em_mailer_prefs_construct (EMMailerPrefs *prefs) { @@ -886,7 +886,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) EMConfigTargetPrefs *target; GSList *l; char *gladefile; - + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "mail-config.glade", NULL); @@ -910,13 +910,13 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) e_config_add_items((EConfig *)ec, l, NULL, NULL, emmp_free, prefs); /* General tab */ - + /* Message Display */ prefs->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkMarkTimeout")); toggle_button_init (prefs, prefs->timeout_toggle, FALSE, "/apps/evolution/mail/display/mark_seen", G_CALLBACK (toggle_button_toggled)); - + prefs->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout")); spin_button_init (prefs, prefs->timeout, "/apps/evolution/mail/display/mark_seen_timeout", @@ -926,30 +926,30 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) toggle_button_init (prefs, prefs->mlimit_toggle, FALSE, "/apps/evolution/mail/display/force_message_limit", G_CALLBACK (toggle_button_toggled)); - + prefs->mlimit_count = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "mlimit_spin")); spin_button_init (prefs, prefs->mlimit_count, "/apps/evolution/mail/display/message_text_part_limit", 1, G_CALLBACK (mlimit_count_changed)); - + prefs->address_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "address_checkbox")); toggle_button_init (prefs, prefs->address_toggle, FALSE, "/apps/evolution/mail/display/address_compress", G_CALLBACK (toggle_button_toggled)); - + prefs->address_count = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "address_spin")); spin_button_init (prefs, prefs->address_count, "/apps/evolution/mail/display/address_count", 1, G_CALLBACK (address_compress_count_changed)); - + prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset")); charset_menu_init (prefs); - + prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations")); toggle_button_init (prefs, prefs->citation_highlight, FALSE, "/apps/evolution/mail/display/mark_citations", G_CALLBACK (toggle_button_toggled)); - + prefs->citation_color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, "colorButtonHighlightCitations")); buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL); color_button_set_color (prefs->citation_color, buf ? buf : "#737373"); @@ -957,40 +957,40 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL)) gtk_widget_set_sensitive ((GtkWidget *) prefs->citation_color, FALSE); g_free (buf); - + /* Deleting Mail */ prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit")); prefs->empty_trash_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuEmptyTrashDays")); emmp_empty_trash_init (prefs); - + prefs->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge")); toggle_button_init (prefs, prefs->confirm_expunge, FALSE, "/apps/evolution/mail/prompts/expunge", G_CALLBACK (toggle_button_toggled)); - + /* New Mail Notification */ locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/notify/type", NULL); - + val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/notify/type", NULL); prefs->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyNot")); gtk_toggle_button_set_active (prefs->notify_not, val == MAIL_CONFIG_NOTIFY_NOT); g_signal_connect (prefs->notify_not, "toggled", G_CALLBACK (notify_type_changed), prefs); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_not, FALSE); - + prefs->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyBeep")); - prefs->notify_sound_file = GTK_FILE_CHOOSER_BUTTON (glade_xml_get_widget (gui, "fileNotifyPlaySoundButton")); + prefs->notify_sound_file = GTK_FILE_CHOOSER_BUTTON (glade_xml_get_widget (gui, "fileNotifyPlaySoundButton")); gtk_toggle_button_set_active (prefs->notify_beep, val == MAIL_CONFIG_NOTIFY_BEEP); g_signal_connect (prefs->notify_beep, "toggled", G_CALLBACK (notify_type_changed), prefs); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_beep, FALSE); - + prefs->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyPlaySound")); gtk_toggle_button_set_active (prefs->notify_play_sound, val == MAIL_CONFIG_NOTIFY_PLAY_SOUND); g_signal_connect (prefs->notify_play_sound, "toggled", G_CALLBACK (notify_type_changed), prefs); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_play_sound, FALSE); - + buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL); if (buf && *buf) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (prefs->notify_sound_file), buf); @@ -999,7 +999,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) if (val != MAIL_CONFIG_NOTIFY_PLAY_SOUND) gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_sound_file, FALSE); g_free (buf); - + /* Mail Fonts */ font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL); prefs->font_fixed = GTK_FONT_BUTTON (glade_xml_get_widget (gui, "FontFixed")); @@ -1009,7 +1009,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) g_signal_connect (prefs->font_fixed, "font-set", G_CALLBACK (font_changed), prefs); if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL)) gtk_widget_set_sensitive ((GtkWidget *) prefs->font_fixed, FALSE); - + font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL); prefs->font_variable = GTK_FONT_BUTTON (glade_xml_get_widget (gui, "FontVariable")); gtk_font_button_set_font_name (prefs->font_variable, font); @@ -1018,29 +1018,29 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) g_signal_connect (prefs->font_variable, "font-set", G_CALLBACK (font_changed), prefs); if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL)) gtk_widget_set_sensitive ((GtkWidget *) prefs->font_variable, FALSE); - + prefs->font_share = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radFontUseSame")); toggle_button_init (prefs, prefs->font_share, TRUE, "/apps/evolution/mail/display/fonts/use_custom", G_CALLBACK (custom_font_changed)); custom_font_changed (prefs->font_share, prefs); - + /* HTML Mail tab */ - + /* Loading Images */ locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/load_http_images", NULL); - + val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", NULL); prefs->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesNever")); gtk_toggle_button_set_active (prefs->images_never, val == MAIL_CONFIG_HTTP_NEVER); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->images_never, FALSE); - + prefs->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesSometimes")); gtk_toggle_button_set_active (prefs->images_sometimes, val == MAIL_CONFIG_HTTP_SOMETIMES); if (locked) gtk_widget_set_sensitive ((GtkWidget *) prefs->images_sometimes, FALSE); - + prefs->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesAlways")); gtk_toggle_button_set_active (prefs->images_always, val == MAIL_CONFIG_HTTP_ALWAYS); if (locked) @@ -1054,12 +1054,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) toggle_button_init (prefs, prefs->show_animated, FALSE, "/apps/evolution/mail/display/animate_images", G_CALLBACK (toggle_button_toggled)); - + prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); toggle_button_init (prefs, prefs->prompt_unwanted_html, FALSE, "/apps/evolution/mail/prompts/unwanted_html", G_CALLBACK (toggle_button_toggled)); - + /* Labels... */ locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/labels", NULL); i = 0; @@ -1068,33 +1068,33 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) MailConfigLabel *label; char *widget_name; label = list->data; - + widget_name = g_strdup_printf ("txtLabel%d", i); prefs->labels[i].name = GTK_ENTRY (glade_xml_get_widget (gui, widget_name)); gtk_widget_set_sensitive ((GtkWidget *) prefs->labels[i].name, !locked); g_free (widget_name); - + widget_name = g_strdup_printf ("colorLabel%d", i); prefs->labels[i].color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, widget_name)); gtk_widget_set_sensitive ((GtkWidget *) prefs->labels[i].color, !locked); g_free (widget_name); - + gtk_entry_set_text (prefs->labels[i].name, label->name); g_signal_connect (prefs->labels[i].name, "changed", G_CALLBACK (label_entry_changed), prefs); - + color_button_set_color (prefs->labels[i].color, label->colour); g_signal_connect (prefs->labels[i].color, "color-set", G_CALLBACK (label_color_set), prefs); - + atk_object_set_name(gtk_widget_get_accessible((GtkWidget *)prefs->labels[i].color), label->name); i++; list = list->next; } - + prefs->restore_labels = GTK_BUTTON (glade_xml_get_widget (gui, "cmdRestoreLabels")); gtk_widget_set_sensitive ((GtkWidget *) prefs->restore_labels, !locked); g_signal_connect (prefs->restore_labels, "clicked", G_CALLBACK (restore_labels_clicked), prefs); - + /* headers */ locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/headers", NULL); @@ -1108,21 +1108,21 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) G_CALLBACK (toggle_button_toggled)); if (!gtk_toggle_button_get_active (prefs->photo_show)) gtk_widget_set_sensitive ((GtkWidget *) prefs->photo_local, FALSE); - + /* always de-sensitised until the user types something in the entry */ prefs->add_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersAdd")); gtk_widget_set_sensitive ((GtkWidget *) prefs->add_header, FALSE); - + /* always de-sensitised until the user selects a header in the list */ prefs->remove_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersRemove")); gtk_widget_set_sensitive ((GtkWidget *) prefs->remove_header, FALSE); - + prefs->entry_header = GTK_ENTRY (glade_xml_get_widget (gui, "txtHeaders")); gtk_widget_set_sensitive ((GtkWidget *) prefs->entry_header, !locked); - + prefs->header_list = GTK_TREE_VIEW (glade_xml_get_widget (gui, "treeHeaders")); gtk_widget_set_sensitive ((GtkWidget *) prefs->header_list, !locked); - + selection = gtk_tree_view_get_selection (prefs->header_list); g_signal_connect (selection, "changed", G_CALLBACK (emmp_header_list_row_selected), prefs); g_signal_connect (prefs->entry_header, "changed", G_CALLBACK (emmp_header_entry_changed), prefs); @@ -1132,29 +1132,29 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) g_signal_connect (prefs->add_header, "clicked", G_CALLBACK (emmp_header_add_header), prefs); g_signal_connect (prefs->remove_header, "clicked", G_CALLBACK (emmp_header_remove_header), prefs); gtk_tree_view_set_model (prefs->header_list, GTK_TREE_MODEL (prefs->header_list_store)); - + renderer = gtk_cell_renderer_toggle_new (); g_object_set (renderer, "activatable", TRUE, NULL); g_signal_connect (renderer, "toggled", G_CALLBACK (emmp_header_list_enabled_toggled), prefs); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1, + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1, "Enabled", renderer, - "active", HEADER_LIST_ENABLED_COLUMN, + "active", HEADER_LIST_ENABLED_COLUMN, NULL); renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1, + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1, "Name", renderer, - "text", HEADER_LIST_NAME_COLUMN, + "text", HEADER_LIST_NAME_COLUMN, NULL); - - /* populated the listview with entries; firstly we add all the default headers, and then - we add read header configuration out of gconf. If a header in gconf is a default header, + + /* populated the listview with entries; firstly we add all the default headers, and then + we add read header configuration out of gconf. If a header in gconf is a default header, we update the enabled flag accordingly */ header_add_list = NULL; default_header_hash = g_hash_table_new (g_str_hash, g_str_equal); for (i = 0; i < G_N_ELEMENTS (default_headers); i++) { struct _EMMailerPrefsHeader *h; - + h = g_malloc (sizeof (struct _EMMailerPrefsHeader)); h->is_default = TRUE; h->name = g_strdup (default_headers[i]); @@ -1162,14 +1162,14 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) g_hash_table_insert (default_header_hash, (gpointer) default_headers[i], h); header_add_list = g_slist_append (header_add_list, h); } - + /* read stored headers from gconf */ header_config_list = gconf_client_get_list (prefs->gconf, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, NULL); p = header_config_list; while (p) { struct _EMMailerPrefsHeader *h, *def; char *xml = (char *) p->data; - + h = em_mailer_prefs_header_from_xml (xml); if (h) { def = g_hash_table_lookup (default_header_hash, h->name); @@ -1181,38 +1181,38 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) header_add_list = g_slist_append (header_add_list, h); } } - + p = p->next; } - + g_hash_table_destroy (default_header_hash); g_slist_foreach (header_config_list, (GFunc) g_free, NULL); g_slist_free (header_config_list); - + p = header_add_list; while (p) { struct _EMMailerPrefsHeader *h = (struct _EMMailerPrefsHeader *) p->data; const char *name; - + if (g_ascii_strcasecmp (h->name, EM_FORMAT_HEADER_XMAILER) == 0) name = _("Mailer"); else name = _(h->name); - + gtk_list_store_append (prefs->header_list_store, &iter); - gtk_list_store_set (prefs->header_list_store, &iter, - HEADER_LIST_NAME_COLUMN, name, - HEADER_LIST_ENABLED_COLUMN, h->enabled, - HEADER_LIST_IS_DEFAULT_COLUMN, h->is_default, - HEADER_LIST_HEADER_COLUMN, h->name, + gtk_list_store_set (prefs->header_list_store, &iter, + HEADER_LIST_NAME_COLUMN, name, + HEADER_LIST_ENABLED_COLUMN, h->enabled, + HEADER_LIST_IS_DEFAULT_COLUMN, h->is_default, + HEADER_LIST_HEADER_COLUMN, h->name, -1); - + em_mailer_prefs_header_free (h); p = p->next; } - + g_slist_free (header_add_list); - + /* Junk prefs */ prefs->check_incoming = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkCheckIncomingMail")); toggle_button_init (prefs, prefs->check_incoming, FALSE, @@ -1222,12 +1222,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) prefs->empty_junk = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "junk_empty_check")); prefs->empty_junk_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "junk_empty_combo")); emmp_empty_junk_init (prefs); - + prefs->default_junk_plugin = GTK_COMBO_BOX (glade_xml_get_widget (gui, "default_junk_plugin")); prefs->plugin_status = GTK_LABEL (glade_xml_get_widget (gui, "plugin_status")); - prefs->plugin_image = GTK_IMAGE (glade_xml_get_widget (gui, "plugin_image")); + prefs->plugin_image = GTK_IMAGE (glade_xml_get_widget (gui, "plugin_image")); junk_plugin_setup (GTK_WIDGET (prefs->default_junk_plugin), prefs); - + /* get our toplevel widget */ target = em_config_target_new_prefs(ec, prefs->gconf); e_config_set_target((EConfig *)ec, (EConfigTarget *)target); @@ -1239,10 +1239,10 @@ GtkWidget * em_mailer_prefs_new (void) { EMMailerPrefs *new; - + new = (EMMailerPrefs *) g_object_new (em_mailer_prefs_get_type (), NULL); em_mailer_prefs_construct (new); - + return (GtkWidget *) new; } @@ -1253,27 +1253,27 @@ emmp_header_from_xmldoc (xmlDocPtr doc) struct _EMMailerPrefsHeader *h; xmlNodePtr root; xmlChar *name; - + if (doc == NULL) return NULL; - + root = doc->children; if (strcmp ((char *)root->name, "header") != 0) return NULL; - + name = xmlGetProp (root, (const unsigned char *)"name"); if (name == NULL) return NULL; - + h = g_malloc0 (sizeof (struct _EMMailerPrefsHeader)); h->name = g_strdup ((gchar *)name); xmlFree (name); - + if (xmlHasProp (root, (const unsigned char *)"enabled")) h->enabled = 1; else h->enabled = 0; - + return h; } @@ -1281,9 +1281,9 @@ emmp_header_from_xmldoc (xmlDocPtr doc) * em_mailer_prefs_header_from_xml * @xml: XML configuration data * - * Parses passed XML data, which should be of - * the format <header name="foo" enabled />, and - * returns a EMMailerPrefs structure, or NULL if there + * Parses passed XML data, which should be of + * the format <header name="foo" enabled />, and + * returns a EMMailerPrefs structure, or NULL if there * is an error. **/ struct _EMMailerPrefsHeader * @@ -1291,13 +1291,13 @@ em_mailer_prefs_header_from_xml (const char *xml) { struct _EMMailerPrefsHeader *header; xmlDocPtr doc; - + if (!(doc = xmlParseDoc ((unsigned char *) xml))) return NULL; - + header = emmp_header_from_xmldoc (doc); xmlFreeDoc (doc); - + return header; } @@ -1305,7 +1305,7 @@ em_mailer_prefs_header_from_xml (const char *xml) * em_mailer_prefs_header_free * @header: header to free * - * Frees the memory associated with the passed header + * Frees the memory associated with the passed header * structure. */ void @@ -1313,7 +1313,7 @@ em_mailer_prefs_header_free (struct _EMMailerPrefsHeader *header) { if (header == NULL) return; - + g_free (header->name); g_free (header); } @@ -1322,7 +1322,7 @@ em_mailer_prefs_header_free (struct _EMMailerPrefsHeader *header) * em_mailer_prefs_header_to_xml * @header: header from which to generate XML * - * Returns the passed header as a XML structure, + * Returns the passed header as a XML structure, * or NULL on error */ char * @@ -1333,25 +1333,25 @@ em_mailer_prefs_header_to_xml (struct _EMMailerPrefsHeader *header) xmlChar *xml; char *out; int size; - + g_return_val_if_fail (header != NULL, NULL); g_return_val_if_fail (header->name != NULL, NULL); - + doc = xmlNewDoc ((const unsigned char *)"1.0"); - + root = xmlNewDocNode (doc, NULL, (const unsigned char *)"header", NULL); xmlSetProp (root, (const unsigned char *)"name", (unsigned char *)header->name); if (header->enabled) xmlSetProp (root, (const unsigned char *)"enabled", NULL); - + xmlDocSetRootElement (doc, root); xmlDocDumpMemory (doc, &xml, &size); xmlFreeDoc (doc); - + out = g_malloc (size + 1); memcpy (out, xml, size); out[size] = '\0'; xmlFree (xml); - + return out; } diff --git a/mail/em-mailer-prefs.h b/mail/em-mailer-prefs.h index fe3bb13003..163d6f9406 100644 --- a/mail/em-mailer-prefs.h +++ b/mail/em-mailer-prefs.h @@ -62,14 +62,14 @@ struct _EMMailerPrefsHeader { struct _EMMailerPrefs { GtkVBox parent_object; - + GNOME_Evolution_Shell shell; - + struct _GladeXML *gui; struct _GConfClient *gconf; - + /* General tab */ - + /* Message Display */ struct _GtkToggleButton *timeout_toggle; struct _GtkSpinButton *timeout; @@ -80,28 +80,28 @@ struct _EMMailerPrefs { struct _GtkOptionMenu *charset; struct _GtkToggleButton *citation_highlight; struct _GtkColorButton *citation_color; - + /* Deleting Mail */ struct _GtkToggleButton *empty_trash; struct _GtkOptionMenu *empty_trash_days; struct _GtkToggleButton *confirm_expunge; - + /* New Mail Notification */ struct _GtkToggleButton *notify_not; struct _GtkToggleButton *notify_beep; struct _GtkToggleButton *notify_play_sound; struct _GtkFileChooserButton *notify_sound_file; - + /* HTML Mail tab */ struct _GtkFontButton *font_variable; struct _GtkFontButton *font_fixed; struct _GtkToggleButton *font_share; - + /* Loading Images */ struct _GtkToggleButton *images_always; struct _GtkToggleButton *images_sometimes; struct _GtkToggleButton *images_never; - + struct _GtkToggleButton *show_animated; struct _GtkToggleButton *autodetect_links; struct _GtkToggleButton *prompt_unwanted_html; @@ -126,7 +126,7 @@ struct _EMMailerPrefs { struct _GtkToggleButton *check_incoming; struct _GtkToggleButton *empty_junk; struct _GtkOptionMenu *empty_junk_days; - + struct _GtkToggleButton *sa_local_tests_only; struct _GtkToggleButton *sa_use_daemon; struct _GtkComboBox *default_junk_plugin; @@ -136,9 +136,9 @@ struct _EMMailerPrefs { struct _EMMailerPrefsClass { GtkVBoxClass parent_class; - + /* signals */ - + }; GtkType em_mailer_prefs_get_type (void); diff --git a/mail/em-menu.c b/mail/em-menu.c index 2f4aa43ad2..69fc7839f8 100644 --- a/mail/em-menu.c +++ b/mail/em-menu.c @@ -139,12 +139,12 @@ EMMenu *em_menu_new(const char *menuid) /** * em_menu_target_new_select: * @folder: The selection will ref this for the life of it. - * @folder_uri: + * @folder_uri: * @uids: The selection will free this when done with it. - * + * * Create a new selection popup target. - * - * Return value: + * + * Return value: **/ EMMenuTargetSelect * em_menu_target_new_select(EMMenu *emp, struct _CamelFolder *folder, const char *folder_uri, GPtrArray *uids) @@ -168,10 +168,10 @@ em_menu_target_new_select(EMMenu *emp, struct _CamelFolder *folder, const char * camel_object_ref(folder); mask &= ~EM_MENU_SELECT_FOLDER; - + if (em_utils_folder_is_sent(folder, folder_uri)) mask &= ~EM_MENU_SELECT_EDIT; - + if (!(em_utils_folder_is_drafts(folder, folder_uri) || em_utils_folder_is_outbox(folder, folder_uri)) && uids->len == 1) @@ -196,7 +196,7 @@ em_menu_target_new_select(EMMenu *emp, struct _CamelFolder *folder, const char * mask &= ~EM_MENU_SELECT_MARK_UNREAD; else mask &= ~EM_MENU_SELECT_MARK_READ; - + if (flags & CAMEL_MESSAGE_DELETED) mask &= ~EM_MENU_SELECT_UNDELETE; else @@ -211,7 +211,7 @@ em_menu_target_new_select(EMMenu *emp, struct _CamelFolder *folder, const char * mask &= ~EM_MENU_SELECT_MARK_NOJUNK; else mask &= ~EM_MENU_SELECT_MARK_JUNK; - + tmp = camel_message_info_user_tag(info, "follow-up"); if (tmp && *tmp) { mask &= ~EM_MENU_SELECT_FLAG_CLEAR; @@ -236,12 +236,12 @@ em_menu_target_new_select(EMMenu *emp, struct _CamelFolder *folder, const char * /** * em_menu_target_new_window: - * @emp: - * @window: - * + * @emp: + * @window: + * * create a dummy target which references some sort of widget. - * - * Return value: + * + * Return value: **/ EMMenuTargetWidget * em_menu_target_new_widget(EMMenu *emp, struct _GtkWidget *w) @@ -352,7 +352,7 @@ GType em_menu_hook_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMMenuHookClass), NULL, NULL, (GClassInitFunc) emph_class_init, NULL, NULL, @@ -362,6 +362,6 @@ em_menu_hook_get_type(void) emph_parent_class = g_type_class_ref(e_menu_hook_get_type()); type = g_type_register_static(e_menu_hook_get_type(), "EMMenuHook", &info, 0); } - + return type; } diff --git a/mail/em-message-browser.c b/mail/em-message-browser.c index 5a963ef3bf..ef6e68b390 100644 --- a/mail/em-message-browser.c +++ b/mail/em-message-browser.c @@ -141,11 +141,11 @@ static void emmb_class_init(GObjectClass *klass) { klass->finalize = emmb_finalise; - + ((GtkObjectClass *)klass)->destroy = emmb_destroy; - + ((EMFolderViewClass *) klass)->update_message_style = FALSE; - + ((EMFolderViewClass *)klass)->set_message = emmb_set_message; ((EMFolderViewClass *)klass)->activate = emmb_activate; } @@ -177,10 +177,10 @@ static void window_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GConfClient *gconf; - + /* save to in-memory variable for current session access */ window_size = *allocation; - + /* save the setting across sessions */ gconf = gconf_client_get_default (); gconf_client_set_int (gconf, "/apps/evolution/mail/message_window/width", window_size.width, NULL); @@ -193,7 +193,7 @@ emmb_list_message_selected (struct _MessageList *ml, const char *uid, EMMessageB { EMFolderView *emfv = (EMFolderView *) emmb; CamelMessageInfo *info; - + if (uid && (info = camel_folder_get_message_info (emfv->folder, uid))) { gtk_window_set_title ((GtkWindow *) emmb->window, camel_message_info_subject (info)); gtk_widget_grab_focus ((GtkWidget *) (emmb->view.preview->formathtml.html)); @@ -222,10 +222,10 @@ messagebrowser_key_pressed (EMMessageBrowser *emmb, GdkEventKey *event, void *us { if (event->keyval == GDK_Escape) { gtk_widget_destroy(gtk_widget_get_toplevel((GtkWidget *)emmb)); - g_signal_stop_emission_by_name (emmb, "key-press-event"); + g_signal_stop_emission_by_name (emmb, "key-press-event"); return TRUE; } - + return FALSE; } @@ -246,34 +246,34 @@ GtkWidget *em_message_browser_window_new(void) bonobo_ui_component_set_container(uic, BONOBO_OBJREF(uicont), NULL); em_folder_view_activate((EMFolderView *)emmb, uic, TRUE); - + if (window_size.width == 0) { /* initialize @window_size with the previous session's size */ GConfClient *gconf; GError *err = NULL; - + gconf = gconf_client_get_default (); - + window_size.width = gconf_client_get_int (gconf, "/apps/evolution/mail/message_window/width", &err); if (err != NULL) { window_size.width = DEFAULT_WIDTH; g_clear_error (&err); } - + window_size.height = gconf_client_get_int (gconf, "/apps/evolution/mail/message_window/height", &err); if (err != NULL) { window_size.height = DEFAULT_HEIGHT; g_clear_error (&err); } - + g_object_unref (gconf); } - + gtk_window_set_default_size ((GtkWindow *) emmb->window, window_size.width, window_size.height); g_signal_connect (emmb->window, "size-allocate", G_CALLBACK (window_size_allocate), NULL); g_signal_connect (((EMFolderView *) emmb)->list, "message_selected", G_CALLBACK (emmb_list_message_selected), emmb); - g_signal_connect (emmb, "key-press-event" , G_CALLBACK (messagebrowser_key_pressed), NULL); - + g_signal_connect (emmb, "key-press-event" , G_CALLBACK (messagebrowser_key_pressed), NULL); + /* cleanup? */ return (GtkWidget *)emmb; @@ -286,19 +286,19 @@ emmb_set_message(EMFolderView *emfv, const char *uid, int nomarkseen) { EMMessageBrowser *emmb = (EMMessageBrowser *) emfv; CamelMessageInfo *info; - + emmb_parent->set_message(emfv, uid, nomarkseen); - + if (uid == NULL) { gtk_widget_destroy((GtkWidget *)emfv); return; } - + if ((info = camel_folder_get_message_info (emfv->folder, uid))) { gtk_window_set_title ((GtkWindow *) emmb->window, camel_message_info_subject (info)); camel_folder_free_message_info (emfv->folder, info); } - + /* Well we don't know if it got displayed (yet) ... but whatever ... */ if (!nomarkseen) camel_folder_set_message_flags(emfv->folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); @@ -327,7 +327,7 @@ emmb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int state) bonobo_ui_component_set_prop(uic, "/commands/EditPaste", "sensitive", "0", NULL); } else { const BonoboUIVerb *v; - + for (v = &emmb_verbs[0]; v->cname; v++) bonobo_ui_component_remove_verb(uic, v->cname); diff --git a/mail/em-migrate.c b/mail/em-migrate.c index c290b60330..1c64c5e659 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -86,15 +86,15 @@ emm_load_xml (const char *dirname, const char *filename) xmlDocPtr doc; struct stat st; char *path; - + path = g_strdup_printf ("%s/%s", dirname, filename); if (stat (path, &st) == -1 || !(doc = xmlParseFile (path))) { g_free (path); return NULL; } - + g_free (path); - + return doc; } @@ -103,11 +103,11 @@ emm_save_xml (xmlDocPtr doc, const char *dirname, const char *filename) { char *path; int retval; - + path = g_strdup_printf ("%s/%s", dirname, filename); retval = e_xml_save_file (path, doc); g_free (path); - + return retval; } @@ -115,15 +115,15 @@ static xmlNodePtr xml_find_node (xmlNodePtr parent, const char *name) { xmlNodePtr node; - + node = parent->children; while (node != NULL) { if (node->name && !strcmp ((char *)node->name, name)) return node; - + node = node->next; } - + return NULL; } @@ -132,25 +132,25 @@ upgrade_xml_uris (xmlDocPtr doc, char * (* upgrade_uri) (const char *uri)) { xmlNodePtr root, node; char *uri, *new; - + if (!doc || !(root = xmlDocGetRootElement (doc))) return; - + if (!root->name || strcmp ((char *)root->name, "filteroptions") != 0) { /* root node is not <filteroptions>, nothing to upgrade */ return; } - + if (!(node = xml_find_node (root, "ruleset"))) { /* no ruleset node, nothing to upgrade */ return; } - + node = node->children; while (node != NULL) { if (node->name && !strcmp ((char *)node->name, "rule")) { xmlNodePtr actionset, part, val, n; - + if ((actionset = xml_find_node (node, "actionset"))) { /* filters.xml */ part = actionset->children; @@ -160,26 +160,26 @@ upgrade_xml_uris (xmlDocPtr doc, char * (* upgrade_uri) (const char *uri)) while (val != NULL) { if (val->name && !strcmp ((char *)val->name, "value")) { char *type; - + type = (char *)xmlGetProp (val, (const unsigned char *)"type"); if (type && !strcmp ((char *)type, "folder")) { if ((n = xml_find_node (val, "folder"))) { uri = (char *)xmlGetProp (n, (const unsigned char *)"uri"); new = upgrade_uri (uri); xmlFree (uri); - + xmlSetProp (n, (const unsigned char *)"uri", (unsigned char *)new); g_free (new); } } - + xmlFree (type); } - + val = val->next; } } - + part = part->next; } } else if ((actionset = xml_find_node (node, "sources"))) { @@ -190,16 +190,16 @@ upgrade_xml_uris (xmlDocPtr doc, char * (* upgrade_uri) (const char *uri)) uri = (char *)xmlGetProp (n, (const unsigned char *)"uri"); new = upgrade_uri (uri); xmlFree (uri); - + xmlSetProp (n, (const unsigned char *)"uri", (unsigned char *)new); g_free (new); } - + n = n->next; } } } - + node = node->next; } } @@ -255,7 +255,7 @@ static char * get_base_uri(const char *val) { const char *tmp; - + tmp = strchr(val, ':'); if (tmp) { tmp++; @@ -263,7 +263,7 @@ get_base_uri(const char *val) tmp += 2; tmp = strchr(tmp, '/'); } - + if (tmp) return g_strndup(val, tmp-val); else @@ -274,21 +274,21 @@ static char * upgrade_xml_uris_1_0 (const char *uri) { char *out = NULL; - + /* upgrades camel uri's */ if (strncmp (uri, "imap:", 5) == 0) { char *base_uri, dir_sep, *folder, *p; struct _account_info_1_0 *ai; - + /* add namespace, canonicalise dir_sep to / */ base_uri = get_base_uri (uri); ai = g_hash_table_lookup (accounts_1_0, base_uri); - + if (ai == NULL) { g_free (base_uri); return NULL; } - + dir_sep = ai->u.imap.dir_sep; if (dir_sep == 0) { /* no dir_sep listed, try get it from the namespace, if set */ @@ -304,34 +304,34 @@ upgrade_xml_uris_1_0 (const char *uri) p++; } } - + /* give up ... */ if (dir_sep == 0) { g_free (base_uri); return NULL; } } - + folder = g_strdup (uri + strlen (base_uri) + 1); - + /* Add the namespace before the mailbox name, unless the mailbox is INBOX */ if (ai->u.imap.namespace && strcmp ((char *)folder, "INBOX") != 0) out = g_strdup_printf ("%s/%s/%s", base_uri, ai->u.imap.namespace, folder); else out = g_strdup_printf ("%s/%s", base_uri, folder); - + p = out; while (*p) { if (*p == dir_sep) *p = '/'; p++; } - + g_free (folder); g_free (base_uri); } else if (strncmp (uri, "exchange:", 9) == 0) { char *base_uri, *folder, *p; - + /* exchange://user@host/exchange/ * -> exchange://user@host/personal/ * */ /* Any url encoding (%xx) in the folder name is also removed */ base_uri = get_base_uri (uri); @@ -346,7 +346,7 @@ upgrade_xml_uris_1_0 (const char *uri) /* these should be converted in the accounts table when it is loaded */ g_warning ("exchanget: uri not converted: '%s'", uri); } - + return out; } @@ -357,7 +357,7 @@ parse_lsub (const char *lsub, char *dir_sep) static regex_t pat; regmatch_t match[3]; char *m = "^\\* LSUB \\([^)]*\\) \"?([^\" ]+)\"? \"?(.*)\"?$"; - + if (!comp) { if (regcomp (&pat, m, REG_EXTENDED|REG_ICASE) == -1) { g_warning ("reg comp '%s' failed: %s", m, g_strerror (errno)); @@ -365,7 +365,7 @@ parse_lsub (const char *lsub, char *dir_sep) } comp = 1; } - + if (regexec (&pat, lsub, 3, match, 0) == 0) { if (match[1].rm_so != -1 && match[2].rm_so != -1) { if (dir_sep) @@ -373,7 +373,7 @@ parse_lsub (const char *lsub, char *dir_sep) return g_strndup (lsub + match[2].rm_so, match[2].rm_eo - match[2].rm_so); } } - + return NULL; } @@ -384,19 +384,19 @@ read_imap_storeinfo (struct _account_info_1_0 *si) guint32 tmp; char *buf, *folder, dir_sep, *path, *name, *p; struct _imap_folder_info_1_0 *fi; - + si->u.imap.folders = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, (GDestroyNotify) imap_folder_info_1_0_free); - + /* get details from uri first */ name = strstr (si->uri, ";override_namespace"); if (name) { name = strstr (si->uri, ";namespace="); if (name) { char *end; - + name += strlen (";namespace="); if (*name == '\"') { name++; @@ -404,11 +404,11 @@ read_imap_storeinfo (struct _account_info_1_0 *si) } else { end = strchr (name, ';'); } - + if (end) { /* try get the dir_sep from the namespace */ si->u.imap.namespace = g_strndup (name, end-name); - + p = si->u.imap.namespace; while ((dir_sep = *p++)) { if (dir_sep < '0' @@ -423,7 +423,7 @@ read_imap_storeinfo (struct _account_info_1_0 *si) } } } - + /* now load storeinfo if it exists */ path = g_build_filename (g_get_home_dir (), "evolution", "mail", "imap", si->base_uri + 7, "storeinfo", NULL); storeinfo = fopen (path, "r"); @@ -432,7 +432,7 @@ read_imap_storeinfo (struct _account_info_1_0 *si) g_warning ("could not find imap store info '%s'", path); return -1; } - + /* ignore version */ camel_file_util_decode_uint32 (storeinfo, &tmp); camel_file_util_decode_uint32 (storeinfo, &si->u.imap.capabilities); @@ -446,9 +446,9 @@ read_imap_storeinfo (struct _account_info_1_0 *si) || si->u.imap.namespace[strlen (si->u.imap.namespace) - 1] == '/')) { si->u.imap.namespace[strlen (si->u.imap.namespace) - 1] = 0; } - + d(printf ("namespace '%s' dir_sep '%c'\n", si->u.imap.namespace, si->u.imap.dir_sep ? si->u.imap.dir_sep : '?')); - + while (camel_file_util_decode_string (storeinfo, &buf) == 0) { folder = parse_lsub (buf, &dir_sep); if (folder) { @@ -467,9 +467,9 @@ read_imap_storeinfo (struct _account_info_1_0 *si) g_warning ("Could not parse LIST result '%s'\n", buf); } } - + fclose (storeinfo); - + return 0; } @@ -480,37 +480,37 @@ load_accounts_1_0 (xmlDocPtr doc) char *val, *tmp; int count = 0, i; char key[32]; - + if (!(source = e_bconf_get_path (doc, "/Mail/Accounts"))) return 0; - + if ((val = e_bconf_get_value (source, "num"))) { count = atoi (val); xmlFree (val); } - + /* load account upgrade info for each account */ for (i = 0; i < count; i++) { struct _account_info_1_0 *ai; char *rawuri; - + sprintf (key, "source_url_%d", i); if (!(rawuri = e_bconf_get_value (source, key))) continue; - + ai = g_malloc0 (sizeof (struct _account_info_1_0)); ai->uri = e_bconf_hex_decode (rawuri); ai->base_uri = get_base_uri (ai->uri); sprintf (key, "account_name_%d", i); ai->name = e_bconf_get_string (source, key); - + d(printf("load account '%s'\n", ai->uri)); - + if (!strncmp (ai->uri, "imap:", 5)) { read_imap_storeinfo (ai); } else if (!strncmp (ai->uri, "exchange:", 9)) { xmlNodePtr node; - + d(printf (" upgrade exchange account\n")); /* small hack, poke the source_url into the transport_url for exchanget: transports - this will be picked up later in the conversion */ @@ -527,12 +527,12 @@ load_accounts_1_0 (xmlDocPtr doc) } } xmlFree (rawuri); - + g_hash_table_insert (accounts_1_0, ai->base_uri, ai); if (ai->name) g_hash_table_insert (accounts_name_1_0, ai->name, ai); } - + return 0; } @@ -543,15 +543,15 @@ em_migrate_1_0 (const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr fil g_str_hash, g_str_equal, (GDestroyNotify) NULL, (GDestroyNotify) account_info_1_0_free); - accounts_name_1_0 = g_hash_table_new (g_str_hash, g_str_equal); + accounts_name_1_0 = g_hash_table_new (g_str_hash, g_str_equal); load_accounts_1_0 (config_xmldb); upgrade_xml_uris(filters, upgrade_xml_uris_1_0); upgrade_xml_uris(vfolders, upgrade_xml_uris_1_0); - + g_hash_table_destroy (accounts_1_0); g_hash_table_destroy (accounts_name_1_0); - + return 0; } @@ -562,7 +562,7 @@ is_xml1encoded (const char *txt) const unsigned char *p; int isxml1 = FALSE; int is8bit = FALSE; - + p = (const unsigned char *)txt; while (*p) { if (p[0] == '\\' && p[1] == 'U' && p[2] == '+' @@ -574,11 +574,11 @@ is_xml1encoded (const char *txt) is8bit = TRUE; p++; } - + /* check for invalid utf8 that needs cleaning */ if (is8bit && !isxml1) isxml1 = !g_utf8_validate (txt, -1, NULL); - + return isxml1; } @@ -588,11 +588,11 @@ decode_xml1 (const char *txt) GString *out = g_string_new (""); const unsigned char *p; char *res; - + /* convert: \U+XXXX\ -> utf8 8 bit characters -> utf8 (iso-8859-1) */ - + p = (const unsigned char *) txt; while (*p) { if (p[0] > 0x80 @@ -601,7 +601,7 @@ decode_xml1 (const char *txt) && p[7] == '\\')) { char utf8[8]; gunichar u; - + if (p[0] == '\\') { memcpy (utf8, p + 3, 4); utf8[4] = 0; @@ -616,10 +616,10 @@ decode_xml1 (const char *txt) } p++; } - + res = out->str; g_string_free (out, FALSE); - + return res; } @@ -629,17 +629,17 @@ utf8_reencode (const char *txt) GString *out = g_string_new (""); gchar *p; char *res; - + /* convert: libxml1 8 bit utf8 converted to xml entities byte-by-byte chars -> utf8 */ - + p = (gchar *)txt; - + while (*p) { g_string_append_c (out, (gchar)g_utf8_get_char ((const gchar *)p)); p = (gchar *)g_utf8_next_char (p); } - + res = out->str; if (g_utf8_validate (res, -1, NULL)) { g_string_free (out, FALSE); @@ -669,9 +669,9 @@ upgrade_xml_1_2_rec (xmlNodePtr node) xmlNodePtr work; int i,j; char *txt, *tmp; - + /* upgrades the content of a node, if the node has a specific parent/node name */ - + for (i = 0; tags[i].name; i++) { if (!strcmp ((char *)node->name, tags[i].name)) { if (tags[i].tags != NULL) { @@ -694,7 +694,7 @@ upgrade_xml_1_2_rec (xmlNodePtr node) } break; } - + if (tags[i].props != NULL) { for (j = 0; tags[i].props[j]; j++) { txt = (char *)xmlGetProp (node, (unsigned char *)tags[i].props[j]); @@ -708,13 +708,13 @@ upgrade_xml_1_2_rec (xmlNodePtr node) } } } - + node = node->children; while (node) { upgrade_xml_1_2_rec (node); node = node->next; } - + return 0; } @@ -722,10 +722,10 @@ static int em_upgrade_xml_1_2 (xmlDocPtr doc) { xmlNodePtr root; - + if (!doc || !(root = xmlDocGetRootElement (doc))) return 0; - + return upgrade_xml_1_2_rec (root); } @@ -771,7 +771,7 @@ upgrade_passwords_1_2(void) if (!strcmp((char *)entry->name, "entry")) { char *namep = (char *)xmlGetProp(entry, (const unsigned char *)"name"), *valuep = (char *)xmlGetProp(entry, (const unsigned char *)"value"); - + if (namep && valuep) { char *value = e_bconf_hex_decode(valuep); guchar *decoded; @@ -1038,11 +1038,11 @@ static e_gconf_map_list_t gconf_remap_list[] = { { "/Mail/Notify", mail_notify_map }, { "/Mail/Filesel", mail_filesel_map }, { "/Mail/Composer", mail_composer_map }, - + { "/Importer/Elm", importer_elm_map }, { "/Importer/Pine", importer_pine_map }, { "/Importer/Netscape", importer_netscape_map }, - + { 0 }, }; @@ -1066,9 +1066,9 @@ bconf_import(GConfClient *gconf, xmlDocPtr config_xmldb) char *val, *lab, *col; GSList *list, *l; int i; - + e_bconf_import(gconf, config_xmldb, gconf_remap_list); - + /* Labels: label string + label colour as integer -> label string:# colour as hex */ @@ -1084,12 +1084,12 @@ bconf_import(GConfClient *gconf, xmlDocPtr config_xmldb) g_free(col); } else strcpy(colx, label_default[i].colour); - + val = g_strdup_printf("%s:%s", lab ? lab : label_default[i].label, colx); list = g_slist_append(list, val); g_free(lab); } - + gconf_client_set_list(gconf, "/apps/evolution/mail/labels", GCONF_VALUE_STRING, list, NULL); while (list) { l = list->next; @@ -1100,15 +1100,15 @@ bconf_import(GConfClient *gconf, xmlDocPtr config_xmldb) } else { g_warning("could not find /Mail/Labels in old config database, skipping"); } - + /* Accounts: The flat bonobo-config structure is remapped to a list of xml blobs. Upgrades as necessary */ e_bconf_import_xml_blob(gconf, config_xmldb, account_map, "/Mail/Accounts", "/apps/evolution/mail/accounts", "account", "uid"); - + /* Same for signatures */ e_bconf_import_xml_blob(gconf, config_xmldb, signature_map, "/Mail/Signatures", "/apps/evolution/mail/signatures", "signature", NULL); - + return 0; } @@ -1116,11 +1116,11 @@ static int em_migrate_1_2(const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex) { GConfClient *gconf; - + gconf = gconf_client_get_default(); bconf_import(gconf, config_xmldb); g_object_unref(gconf); - + em_upgrade_xml_1_2(filters); em_upgrade_xml_1_2(vfolders); upgrade_passwords_1_2(); @@ -1137,14 +1137,14 @@ em_migrate_1_2(const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filt typedef struct _EMMigrateSession { CamelSession parent_object; - + CamelStore *store; /* new folder tree store */ char *srcdir; /* old folder tree path */ } EMMigrateSession; typedef struct _EMMigrateSessionClass { CamelSessionClass parent_class; - + } EMMigrateSessionClass; static CamelType em_migrate_session_get_type (void); @@ -1160,7 +1160,7 @@ static CamelType em_migrate_session_get_type (void) { static CamelType type = CAMEL_INVALID_TYPE; - + if (type == CAMEL_INVALID_TYPE) { type = camel_type_register ( camel_session_get_type (), @@ -1172,7 +1172,7 @@ em_migrate_session_get_type (void) NULL, NULL); } - + return type; } @@ -1180,11 +1180,11 @@ static CamelSession * em_migrate_session_new (const char *path) { CamelSession *session; - + session = CAMEL_SESSION (camel_object_new (EM_MIGRATE_SESSION_TYPE)); - + camel_session_construct (session, path); - + return session; } @@ -1197,35 +1197,35 @@ static void em_migrate_setup_progress_dialog (void) { GtkWidget *vbox, *hbox, *w; - + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title ((GtkWindow *) window, _("Migrating...")); gtk_window_set_modal ((GtkWindow *) window, TRUE); gtk_container_set_border_width ((GtkContainer *) window, 6); - + vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); gtk_container_add ((GtkContainer *) window, vbox); - + w = gtk_label_new (_("The location and hierarchy of the Evolution mailbox " "folders has changed since Evolution 1.x.\n\nPlease be " "patient while Evolution migrates your folders...")); gtk_label_set_line_wrap ((GtkLabel *) w, TRUE); gtk_widget_show (w); gtk_box_pack_start_defaults ((GtkBox *) vbox, w); - + hbox = gtk_hbox_new (FALSE, 6); gtk_widget_show (hbox); gtk_box_pack_start_defaults ((GtkBox *) vbox, hbox); - + label = (GtkLabel *) gtk_label_new (""); gtk_widget_show ((GtkWidget *) label); gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) label); - + progress = (GtkProgressBar *) gtk_progress_bar_new (); gtk_widget_show ((GtkWidget *) progress); gtk_box_pack_start_defaults ((GtkBox *) hbox, (GtkWidget *) progress); - + gtk_widget_show (window); } @@ -1239,13 +1239,13 @@ static void em_migrate_set_folder_name (const char *folder_name) { char *text; - + text = g_strdup_printf (_("Migrating `%s':"), folder_name); gtk_label_set_text (label, text); g_free (text); - + gtk_progress_bar_set_fraction (progress, 0.0); - + while (gtk_events_pending ()) gtk_main_iteration (); } @@ -1254,12 +1254,12 @@ static void em_migrate_set_progress (double percent) { char text[5]; - + snprintf (text, sizeof (text), "%d%%", (int) (percent * 100.0f)); - + gtk_progress_bar_set_fraction (progress, percent); gtk_progress_bar_set_text (progress, text); - + while (gtk_events_pending ()) gtk_main_iteration (); } @@ -1270,24 +1270,24 @@ is_mail_folder (const char *metadata) xmlNodePtr node; xmlDocPtr doc; char *type; - + if (!(doc = xmlParseFile (metadata))) { g_warning ("Cannot parse `%s'", metadata); return FALSE; } - + if (!(node = xmlDocGetRootElement (doc))) { g_warning ("`%s' corrupt: document contains no root node", metadata); xmlFreeDoc (doc); return FALSE; } - + if (!node->name || strcmp ((char *)node->name, "efolder") != 0) { g_warning ("`%s' corrupt: root node is not 'efolder'", metadata); xmlFreeDoc (doc); return FALSE; } - + node = node->children; while (node != NULL) { if (node->name && !strcmp ((char *)node->name, "type")) { @@ -1295,20 +1295,20 @@ is_mail_folder (const char *metadata) if (!strcmp ((char *)type, "mail")) { xmlFreeDoc (doc); xmlFree (type); - + return TRUE; } - + xmlFree (type); - + break; } - + node = node->next; } - + xmlFreeDoc (doc); - + return FALSE; } @@ -1320,38 +1320,38 @@ get_local_et_expanded (const char *dirname) struct stat st; char *buf, *p; int thread_list; - + buf = g_strdup_printf ("%s/evolution/config/file:%s", g_get_home_dir (), dirname); p = buf + strlen (g_get_home_dir ()) + strlen ("/evolution/config/file:"); e_filename_make_safe (p); - + if (stat (buf, &st) == -1) { g_free (buf); return -1; } - + if (!(doc = xmlParseFile (buf))) { g_free (buf); return -1; } - + g_free (buf); - + if (!(node = xmlDocGetRootElement (doc)) || strcmp ((char *)node->name, "expanded_state") != 0) { xmlFreeDoc (doc); return -1; } - + if (!(buf = (char *)xmlGetProp (node, (const unsigned char *)"default"))) { xmlFreeDoc (doc); return -1; } - + thread_list = strcmp (buf, "0") == 0 ? 0 : 1; xmlFree (buf); - + xmlFreeDoc (doc); - + return thread_list; } @@ -1383,7 +1383,7 @@ get_local_store_uri (const char *dirname, char **namep, int *indexp) node = doc->children; if (strcmp((char *)node->name, "folderinfo")) goto dodefault; - + for (node = node->children; node; node = node->next) { if (node->name && !strcmp ((char *)node->name, "folder")) { tmp = (char *)xmlGetProp (node, (const unsigned char *)"type"); @@ -1446,7 +1446,7 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode) errno = EEXIST; return -1; } - + if (g_stat (src, &st) == -1 || (readfd = g_open (src, O_RDONLY | O_BINARY, 0)) == -1) return -1; @@ -1457,58 +1457,58 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode) errno = errnosav; return -1; } - + do { do { nread = read (readfd, readbuf, sizeof (readbuf)); } while (nread == -1 && errno == EINTR); - + if (nread == 0) break; else if (nread < 0) goto exception; - + do { nwritten = write (writefd, readbuf, nread); } while (nwritten == -1 && errno == EINTR); - + if (nwritten < nread) goto exception; - + total += nwritten; -#ifndef G_OS_WIN32 +#ifndef G_OS_WIN32 if (show_progress) em_migrate_set_progress (((double) total) / ((double) st.st_size)); #endif } while (total < st.st_size); - + if (fsync (writefd) == -1) goto exception; - + close (readfd); if (close (writefd) == -1) goto failclose; - + ut.actime = st.st_atime; ut.modtime = st.st_mtime; utime (dest, &ut); chmod (dest, st.st_mode); - + return 0; - + exception: - + errnosav = errno; close (readfd); close (writefd); errno = errnosav; - + failclose: - + errnosav = errno; unlink (dest); errno = errnosav; - + return -1; } @@ -1522,46 +1522,46 @@ cp_r (const char *src, const char *dest, const char *pattern, int mode) size_t slen, dlen; struct stat st; DIR *dir; - + if (g_mkdir_with_parents (dest, 0777) == -1) return -1; - + if (!(dir = opendir (src))) return -1; - + srcpath = g_string_new (src); g_string_append_c (srcpath, '/'); slen = srcpath->len; - + destpath = g_string_new (dest); g_string_append_c (destpath, '/'); dlen = destpath->len; - + while ((dent = readdir (dir))) { if (!strcmp (dent->d_name, ".") || !strcmp (dent->d_name, "..")) continue; - + g_string_truncate (srcpath, slen); g_string_truncate (destpath, dlen); - + g_string_append (srcpath, dent->d_name); g_string_append (destpath, dent->d_name); - + if (stat (srcpath->str, &st) == -1) continue; - + if (S_ISDIR (st.st_mode)) { cp_r (srcpath->str, destpath->str, pattern, mode); } else if (!pattern || !strcmp (dent->d_name, pattern)) { cp (srcpath->str, destpath->str, FALSE, mode); } } - + closedir (dir); - + g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - + return 0; } @@ -1570,7 +1570,7 @@ mbox_build_filename (GString *path, const char *toplevel_dir, const char *full_n { const char *start, *inptr = full_name; int subdirs = 0; - + while (*inptr != '\0') { if (*inptr == '/') subdirs++; @@ -1579,19 +1579,19 @@ mbox_build_filename (GString *path, const char *toplevel_dir, const char *full_n g_string_assign(path, toplevel_dir); g_string_append_c (path, '/'); - + inptr = full_name; while (*inptr != '\0') { start = inptr; while (*inptr != '/' && *inptr != '\0') inptr++; - + g_string_append_len (path, start, inptr - start); - + if (*inptr == '/') { g_string_append (path, ".sbd/"); inptr++; - + /* strip extranaeous '/'s */ while (*inptr == '/') inptr++; @@ -1622,7 +1622,7 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu g_string_free(src, TRUE); return 0; } - + dest = g_string_new(""); uri = get_local_store_uri(dirname, &name, &index); em_migrate_set_folder_name (full_name); @@ -1635,22 +1635,22 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu FILE *fp; char *p; int mode; - + g_string_printf (src, "%s/%s", uri + 5, name); mbox_build_filename (dest, ((CamelService *)session->store)->url->path, full_name); p = strrchr (dest->str, '/'); *p = '\0'; - + slen = src->len; dlen = dest->len; - + if (g_mkdir_with_parents (dest->str, 0777) == -1 && errno != EEXIST) { camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Unable to create new folder `%s': %s"), dest->str, g_strerror(errno)); goto fatal; } - + *p = '/'; mode = CP_UNIQUE; retry_copy: @@ -1677,47 +1677,47 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu goto fatal; } ignore: - + /* create a .cmeta file specifying to index and/or thread the folder */ g_string_truncate (dest, dlen); g_string_append (dest, ".cmeta"); if ((fp = fopen (dest->str, "w")) != NULL) { int fd = fileno (fp); - + /* write the magic string */ if (fwrite ("CLMD", 4, 1, fp) != 1) goto cmeta_err; - + /* write the version (1) */ if (camel_file_util_encode_uint32 (fp, 1) == -1) goto cmeta_err; - + /* write the meta count */ if (camel_file_util_encode_uint32 (fp, thread_list != -1 ? 1 : 0) == -1) goto cmeta_err; - + if (thread_list != -1) { if (camel_file_util_encode_string (fp, "evolution:thread_list") == -1) goto cmeta_err; - + if (camel_file_util_encode_string (fp, thread_list ? "1" : "0") == -1) goto cmeta_err; } - + /* write the prop count (only prop is the index prop) */ if (camel_file_util_encode_uint32 (fp, 1) == -1) goto cmeta_err; - + /* write the index prop tag (== CAMEL_FOLDER_ARG_LAST|CAMEL_ARG_BOO) */ if (camel_file_util_encode_uint32 (fp, CAMEL_FOLDER_ARG_LAST|CAMEL_ARG_BOO) == -1) goto cmeta_err; - + /* write the index prop value */ if (camel_file_util_encode_uint32 (fp, 1) == -1) goto cmeta_err; - + fflush (fp); - + if (fsync (fd) == -1) { cmeta_err: fclose (fp); @@ -1726,12 +1726,12 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu fclose (fp); } } - + /* copy over the metadata files */ for (i = 0; i < sizeof(meta_ext)/sizeof(meta_ext[0]); i++) { g_string_truncate (src, slen); g_string_truncate (dest, dlen); - + g_string_append (src, meta_ext[i]); g_string_append (dest, meta_ext[i]); cp (src->str, dest->str, FALSE, CP_OVERWRITE); @@ -1742,42 +1742,42 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, ex)) || !(old_folder = camel_store_get_folder (local_store, name, 0, ex))) goto fatal; - + flags |= (index ? CAMEL_STORE_FOLDER_BODY_INDEX : 0); if (!(new_folder = camel_store_get_folder (session->store, full_name, flags, ex))) goto fatal; - + if (thread_list != -1) { camel_object_meta_set (new_folder, "evolution:thread_list", thread_list ? "1" : "0"); camel_object_state_write (new_folder); } - + uids = camel_folder_get_uids (old_folder); for (i = 0; i < uids->len; i++) { CamelMimeMessage *message; CamelMessageInfo *info; - + if (!(info = camel_folder_get_message_info (old_folder, uids->pdata[i]))) continue; - + if (!(message = camel_folder_get_message (old_folder, uids->pdata[i], ex))) { camel_folder_free_message_info (old_folder, info); camel_folder_free_uids (old_folder, uids); goto fatal; } - + camel_folder_append_message (new_folder, message, info, NULL, ex); camel_folder_free_message_info (old_folder, info); camel_object_unref (message); - + if (camel_exception_is_set (ex)) break; - + em_migrate_set_progress (((double) i + 1) / ((double) uids->len)); } - + camel_folder_free_uids (old_folder, uids); - + if (camel_exception_is_set (ex)) goto fatal; } @@ -1815,33 +1815,33 @@ em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full g_free (path); return 0; } - + if (!(dir = opendir (path))) { g_free (path); return 0; } - + while (res == 0 && (dent = readdir (dir))) { char *full_path; char *name; if (dent->d_name[0] == '.') continue; - + full_path = g_strdup_printf ("%s/%s", path, dent->d_name); if (stat (full_path, &st) == -1 || !S_ISDIR (st.st_mode)) { g_free (full_path); continue; } - + name = g_strdup_printf ("%s/%s", full_name, dent->d_name); res = em_migrate_dir (session, full_path, name, ex); g_free (full_path); g_free (name); } - + closedir (dir); - + g_free (path); return res; @@ -1861,27 +1861,27 @@ em_migrate_local_folders_1_4 (EMMigrateSession *session, CamelException *ex) session->srcdir, g_strerror(errno)); return -1; } - + em_migrate_setup_progress_dialog (); - + while (res == 0 && (dent = readdir (dir))) { char *full_path; - + if (dent->d_name[0] == '.') continue; - + full_path = g_strdup_printf ("%s/%s", session->srcdir, dent->d_name); if (stat (full_path, &st) == -1 || !S_ISDIR (st.st_mode)) { g_free (full_path); continue; } - + res = em_migrate_dir (session, full_path, dent->d_name, ex); g_free (full_path); } - + closedir (dir); - + em_migrate_close_progress_dialog (); return res; @@ -1892,39 +1892,39 @@ upgrade_xml_uris_1_4 (const char *uri) { char *path, *prefix, *p; CamelURL *url; - + if (!strncmp (uri, "file:", 5)) { url = camel_url_new (uri, NULL); camel_url_set_protocol (url, "email"); camel_url_set_user (url, "local"); camel_url_set_host (url, "local"); - + prefix = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); if (strncmp (url->path, prefix, strlen (prefix)) != 0) { /* uri is busticated - user probably copied from another user's home directory */ camel_url_free (url); g_free (prefix); - + return g_strdup (uri); } path = g_strdup (url->path + strlen (prefix)); g_free (prefix); - + /* modify the path in-place */ p = path + strlen (path) - 12; while (p > path) { if (!strncmp (p, "/subfolders/", 12)) memmove (p, p + 11, strlen (p + 11) + 1); - + p--; } - + camel_url_set_path (url, path); g_free (path); - + path = camel_url_to_string (url, 0); camel_url_free (url); - + return path; } else { return em_uri_from_camel (uri); @@ -1935,38 +1935,38 @@ static void upgrade_vfolder_sources_1_4 (xmlDocPtr doc) { xmlNodePtr root, node; - + if (!doc || !(root = xmlDocGetRootElement (doc))) return; - + if (!root->name || strcmp ((char *)root->name, "filteroptions") != 0) { /* root node is not <filteroptions>, nothing to upgrade */ return; } - + if (!(node = xml_find_node (root, "ruleset"))) { /* no ruleset node, nothing to upgrade */ return; } - + node = node->children; while (node != NULL) { if (node->name && !strcmp ((char *)node->name, "rule")) { xmlNodePtr sources; char *src; - + if (!(src = (char *)xmlGetProp (node, (const unsigned char *)"source"))) src = (char *)xmlStrdup ((const unsigned char *)"local"); /* default to all local folders? */ - + xmlSetProp (node, (const unsigned char *)"source", (const unsigned char *)"incoming"); - + if (!(sources = xml_find_node (node, "sources"))) sources = xmlNewChild (node, NULL, (const unsigned char *)"sources", NULL); - + xmlSetProp (sources, (const unsigned char *)"with", (unsigned char *)src); xmlFree (src); } - + node = node->next; } } @@ -1979,22 +1979,22 @@ get_nth_sig (int id) EIterator *iter; char *uid = NULL; int i = 0; - + list = mail_config_get_signatures (); iter = e_list_get_iterator ((EList *) list); - + while (e_iterator_is_valid (iter) && i < id) { e_iterator_next (iter); i++; } - + if (i == id && e_iterator_is_valid (iter)) { sig = (ESignature *) e_iterator_get (iter); uid = g_strdup (sig->uid); } - + g_object_unref (iter); - + return uid; } @@ -2003,40 +2003,40 @@ em_upgrade_accounts_1_4 (void) { EAccountList *accounts; EIterator *iter; - + if (!(accounts = mail_config_get_accounts ())) return; - + iter = e_list_get_iterator ((EList *) accounts); while (e_iterator_is_valid (iter)) { EAccount *account = (EAccount *) e_iterator_get (iter); char *url; - + if (account->drafts_folder_uri) { url = upgrade_xml_uris_1_4 (account->drafts_folder_uri); g_free (account->drafts_folder_uri); account->drafts_folder_uri = url; } - + if (account->sent_folder_uri) { url = upgrade_xml_uris_1_4 (account->sent_folder_uri); g_free (account->sent_folder_uri); account->sent_folder_uri = url; } - + if (account->id->sig_uid && !strncmp (account->id->sig_uid, "::", 2)) { int sig_id; - + sig_id = strtol (account->id->sig_uid + 2, NULL, 10); g_free (account->id->sig_uid); account->id->sig_uid = get_nth_sig (sig_id); } - + e_iterator_next (iter); } - + g_object_unref (iter); - + mail_config_save_accounts (); } @@ -2059,19 +2059,19 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) g_free(cache_dir); return 0; } - + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Unable to open old POP keep-on-server data `%s': %s"), cache_dir, g_strerror (errno)); g_free (cache_dir); return -1; } - + oldpath = g_string_new (cache_dir); g_string_append_c (oldpath, '/'); olen = oldpath->len; g_free (cache_dir); - + cache_dir = g_build_filename (evolution_dir, "mail", "pop", NULL); if (g_mkdir_with_parents (cache_dir, 0777) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -2082,25 +2082,25 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) closedir (dir); return -1; } - + newpath = g_string_new (cache_dir); g_string_append_c (newpath, '/'); nlen = newpath->len; g_free (cache_dir); - + while (res == 0 && (dent = readdir (dir))) { if (strncmp (dent->d_name, "cache-pop:__", 12) != 0) continue; - + g_string_truncate (oldpath, olen); g_string_truncate (newpath, nlen); - + g_string_append (oldpath, dent->d_name); g_string_append (newpath, dent->d_name + 12); - + /* strip the trailing '_' */ g_string_truncate (newpath, newpath->len - 1); - + if (g_mkdir_with_parents (newpath->str, 0777) == -1 || cp(oldpath->str, (g_string_append(newpath, "/uid-cache"))->str, FALSE, CP_UNIQUE)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -2110,12 +2110,12 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) } } - + g_string_free (oldpath, TRUE); g_string_free (newpath, TRUE); - + closedir (dir); - + return res; } @@ -2124,21 +2124,21 @@ em_migrate_imap_caches_1_4 (const char *evolution_dir, CamelException *ex) { char *src, *dest; struct stat st; - + src = g_build_filename (g_get_home_dir (), "evolution", "mail", "imap", NULL); if (stat (src, &st) == -1 || !S_ISDIR (st.st_mode)) { g_free (src); return 0; } - + dest = g_build_filename (evolution_dir, "mail", "imap", NULL); - + /* we don't care if this fails, it's only a cache... */ cp_r (src, dest, "summary", CP_OVERWRITE); - + g_free (dest); g_free (src); - + return 0; } @@ -2151,14 +2151,14 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e struct dirent *dent; struct stat st; DIR *dir; - + srcpath = g_string_new (g_get_home_dir ()); g_string_append (srcpath, "/evolution/config"); if (stat (srcpath->str, &st) == -1 || !S_ISDIR (st.st_mode)) { g_string_free (srcpath, TRUE); return 0; } - + destpath = g_string_new (evolution_dir); g_string_append (destpath, "/mail/config"); if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) { @@ -2166,49 +2166,49 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e g_string_free (srcpath, TRUE); return 0; } - + g_string_append (srcpath, "/et-expanded-"); slen = srcpath->len; g_string_append (destpath, "/et-expanded-"); dlen = destpath->len; - + evo14_mbox_root = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); e_filename_make_safe (evo14_mbox_root); rlen = strlen (evo14_mbox_root); evo14_mbox_root = g_realloc (evo14_mbox_root, rlen + 2); evo14_mbox_root[rlen++] = '_'; evo14_mbox_root[rlen] = '\0'; - + while ((dent = readdir (dir))) { char *full_name, *inptr, *buf = NULL; const char *filename; GString *new; - + if (strncmp (dent->d_name, "et-expanded-", 12) != 0) continue; - + if (!strncmp (dent->d_name + 12, "file:", 5)) { /* need to munge the filename */ inptr = dent->d_name + 17; - + if (!strncmp (inptr, evo14_mbox_root, rlen)) { /* this should always be the case afaik... */ inptr += rlen; new = g_string_new ("mbox:"); g_string_append_printf (new, "%s/mail/local#", evolution_dir); - + full_name = g_strdup (inptr); inptr = full_name + strlen (full_name) - 12; while (inptr > full_name) { if (!strncmp (inptr, "_subfolders_", 12)) memmove (inptr, inptr + 11, strlen (inptr + 11) + 1); - + inptr--; } - + g_string_append (new, full_name); g_free (full_name); - + filename = buf = new->str; g_string_free (new, FALSE); e_filename_make_safe (buf); @@ -2220,23 +2220,23 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e /* no munging needed */ filename = dent->d_name + 12; } - + g_string_append (srcpath, dent->d_name + 12); g_string_append (destpath, filename); g_free (buf); - + cp (srcpath->str, destpath->str, FALSE, CP_UNIQUE); - + g_string_truncate (srcpath, slen); g_string_truncate (destpath, dlen); } - + closedir (dir); - + g_free (evo14_mbox_root); g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - + return 0; } @@ -2249,14 +2249,14 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * struct dirent *dent; struct stat st; DIR *dir; - + srcpath = g_string_new (g_get_home_dir ()); g_string_append (srcpath, "/evolution/views/mail"); if (stat (srcpath->str, &st) == -1 || !S_ISDIR (st.st_mode)) { g_string_free (srcpath, TRUE); return 0; } - + destpath = g_string_new (evolution_dir); g_string_append (destpath, "/mail/views"); if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) { @@ -2264,31 +2264,31 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * g_string_free (srcpath, TRUE); return 0; } - + g_string_append_c (srcpath, '/'); slen = srcpath->len; g_string_append_c (destpath, '/'); dlen = destpath->len; - + evo14_mbox_root = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); e_filename_make_safe (evo14_mbox_root); rlen = strlen (evo14_mbox_root); evo14_mbox_root = g_realloc (evo14_mbox_root, rlen + 2); evo14_mbox_root[rlen++] = '_'; evo14_mbox_root[rlen] = '\0'; - + while ((dent = readdir (dir))) { char *full_name, *inptr, *buf = NULL; const char *filename, *ext; size_t prelen = 0; GString *new; - + if (dent->d_name[0] == '.') continue; - + if (!(ext = strrchr (dent->d_name, '.'))) continue; - + if (!strcmp (ext, ".galview") || !strcmp ((char *)dent->d_name, "galview.xml")) { /* just copy the file */ filename = dent->d_name; @@ -2296,7 +2296,7 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * } else if (strcmp (ext, ".xml") != 0) { continue; } - + if (!strncmp ((const char *)dent->d_name, "current_view-", 13)) { prelen = 13; } else if (!strncmp ((const char *)dent->d_name, "custom_view-", 12)) { @@ -2305,29 +2305,29 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * /* huh? wtf is this file? */ continue; } - + if (!strncmp (dent->d_name + prelen, "file:", 5)) { /* need to munge the filename */ inptr = dent->d_name + prelen + 5; - + if (!strncmp (inptr, evo14_mbox_root, rlen)) { /* this should always be the case afaik... */ inptr += rlen; new = g_string_new ("mbox:"); g_string_append_printf (new, "%s/mail/local#", evolution_dir); - + full_name = g_strdup (inptr); inptr = full_name + strlen (full_name) - 12; while (inptr > full_name) { if (!strncmp (inptr, "_subfolders_", 12)) memmove (inptr, inptr + 11, strlen (inptr + 11) + 1); - + inptr--; } - + g_string_append (new, full_name); g_free (full_name); - + filename = buf = new->str; g_string_free (new, FALSE); e_filename_make_safe (buf); @@ -2339,26 +2339,26 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * /* no munging needed */ filename = dent->d_name + prelen; } - + copy: g_string_append (srcpath, dent->d_name); if (prelen > 0) g_string_append_len (destpath, dent->d_name, prelen); g_string_append (destpath, filename); g_free (buf); - + cp (srcpath->str, destpath->str, FALSE, CP_UNIQUE); - + g_string_truncate (srcpath, slen); g_string_truncate (destpath, dlen); } - + closedir (dir); - + g_free (evo14_mbox_root); g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - + return 0; } @@ -2533,7 +2533,7 @@ remove_system_searches(xmlDocPtr searches) if (!(node = xml_find_node(node, "ruleset"))) return; - + node = node->children; while (node != NULL) { xmlNodePtr nnode = node->next; @@ -2548,9 +2548,9 @@ remove_system_searches(xmlDocPtr searches) } xmlFree (src); } - + node = nnode; - } + } } static int @@ -2568,9 +2568,9 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders camel_provider_init(); session = (EMMigrateSession *) em_migrate_session_new (path); g_free (path); - - session->srcdir = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); - + + session->srcdir = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); + path = g_strdup_printf ("mbox:%s/.evolution/mail/local", g_get_home_dir ()); if (stat (path + 5, &st) == -1) { if (errno != ENOENT || g_mkdir_with_parents (path + 5, 0777) == -1) { @@ -2583,7 +2583,7 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders return -1; } } - + camel_exception_init (&lex); if (!(session->store = camel_session_get_store ((CamelSession *) session, path, &lex))) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -2596,17 +2596,17 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders return -1; } g_free (path); - + if (em_migrate_local_folders_1_4 (session, ex) == -1) return -1; - + camel_object_unref (session->store); g_free (session->srcdir); - + camel_object_unref (session); - + em_upgrade_accounts_1_4(); - + upgrade_xml_uris(filters, upgrade_xml_uris_1_4); upgrade_vfolder_sources_1_4(vfolders); upgrade_xml_uris(vfolders, upgrade_xml_uris_1_4); @@ -2621,10 +2621,10 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders g_free(path); xmlFreeDoc(searches); } - + if (em_migrate_pop_uid_caches_1_4 (evolution_dir, ex) == -1) return -1; - + /* these are non-fatal */ em_migrate_imap_caches_1_4 (evolution_dir, ex); camel_exception_clear(ex); @@ -2685,7 +2685,7 @@ emm_setup_initial(const char *evolution_dir) /* FIXME: create default folders and stuff... */ d(printf("Setting up initial mail tree\n")); - + base = g_build_filename(evolution_dir, "mail", "local", NULL); if (g_mkdir_with_parents(base, 0777) == -1 && errno != EEXIST) { g_free(base); @@ -2733,28 +2733,28 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel { struct stat st; char *path; - + /* make sure ~/.evolution/mail exists */ path = g_build_filename (evolution_dir, "mail", NULL); if (g_stat (path, &st) == -1) { if (errno != ENOENT || g_mkdir_with_parents (path, 0777) == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Unable to create local mail folders at `%s': %s"), path, g_strerror (errno)); g_free (path); return -1; } } - + g_free (path); - + if (major == 0) return emm_setup_initial(evolution_dir); #ifndef G_OS_WIN32 if (major == 1 && minor < 5) { xmlDocPtr config_xmldb = NULL, filters, vfolders; - + path = g_build_filename (g_get_home_dir (), "evolution", NULL); if (minor <= 2 && !(config_xmldb = emm_load_xml (path, "config.xmldb"))) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, @@ -2766,7 +2766,7 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel filters = emm_load_xml (path, "filters.xml"); vfolders = emm_load_xml (path, "vfolders.xml"); g_free (path); - + if (minor == 0) { if (em_migrate_1_0 (evolution_dir, config_xmldb, filters, vfolders, ex) == -1) { xmlFreeDoc (config_xmldb); @@ -2775,7 +2775,7 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel return -1; } } - + if (minor <= 2) { if (em_migrate_1_2 (evolution_dir, config_xmldb, filters, vfolders, ex) == -1) { xmlFreeDoc (config_xmldb); @@ -2783,10 +2783,10 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel xmlFreeDoc (vfolders); return -1; } - + xmlFreeDoc (config_xmldb); } - + if (minor <= 4) { if (em_migrate_1_4 (evolution_dir, filters, vfolders, ex) == -1) { xmlFreeDoc (filters); @@ -2794,19 +2794,19 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel return -1; } } - + path = g_build_filename (evolution_dir, "mail", NULL); - + if (filters) { emm_save_xml (filters, path, "filters.xml"); xmlFreeDoc (filters); } - + if (vfolders) { emm_save_xml (vfolders, path, "vfolders.xml"); xmlFreeDoc (vfolders); } - + g_free (path); } diff --git a/mail/em-popup.c b/mail/em-popup.c index 63f7291dfe..40e22eb230 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -165,12 +165,12 @@ EMPopup *em_popup_new(const char *menuid) /** * em_popup_target_new_select: * @folder: The selection will ref this for the life of it. - * @folder_uri: + * @folder_uri: * @uids: The selection will free this when done with it. - * + * * Create a new selection popup target. - * - * Return value: + * + * Return value: **/ EMPopupTargetSelect * em_popup_target_new_select(EMPopup *emp, struct _CamelFolder *folder, const char *folder_uri, GPtrArray *uids) @@ -194,10 +194,10 @@ em_popup_target_new_select(EMPopup *emp, struct _CamelFolder *folder, const char camel_object_ref(folder); mask &= ~EM_POPUP_SELECT_FOLDER; - + if (em_utils_folder_is_sent(folder, folder_uri)) mask &= ~EM_POPUP_SELECT_EDIT; - + draft_or_outbox = em_utils_folder_is_drafts(folder, folder_uri) || em_utils_folder_is_outbox(folder, folder_uri); if (!draft_or_outbox && uids->len == 1) mask &= ~EM_POPUP_SELECT_ADD_SENDER; @@ -229,11 +229,11 @@ em_popup_target_new_select(EMPopup *emp, struct _CamelFolder *folder, const char } else if (draft_or_outbox) { /* Show none option */ mask |= EM_POPUP_SELECT_NOT_JUNK; - mask |= EM_POPUP_SELECT_JUNK; + mask |= EM_POPUP_SELECT_JUNK; } else { /* Show both options */ mask &= ~EM_POPUP_SELECT_NOT_JUNK; - mask &= ~EM_POPUP_SELECT_JUNK; + mask &= ~EM_POPUP_SELECT_JUNK; } if (flags & CAMEL_MESSAGE_DELETED) @@ -334,20 +334,20 @@ em_popup_target_new_folder (EMPopup *emp, const char *uri, guint32 info_flags, g mask &= ~(EM_POPUP_FOLDER_STORE|EM_POPUP_FOLDER_INFERIORS); else mask &= ~EM_POPUP_FOLDER_FOLDER; - + url = camel_url_new(uri, NULL); if (url == NULL) goto done; - + if (!(popup_flags & EM_POPUP_FOLDER_STORE)) { const char *path; - + if (popup_flags & EM_POPUP_FOLDER_DELETE) mask &= ~EM_POPUP_FOLDER_DELETE; - + if (!(info_flags & CAMEL_FOLDER_NOINFERIORS)) mask &= ~EM_POPUP_FOLDER_INFERIORS; - + if (info_flags & CAMEL_FOLDER_TYPE_OUTBOX) mask &= ~EM_POPUP_FOLDER_OUTBOX; else @@ -355,17 +355,17 @@ em_popup_target_new_folder (EMPopup *emp, const char *uri, guint32 info_flags, g if (!(info_flags & CAMEL_FOLDER_NOSELECT)) mask &= ~EM_POPUP_FOLDER_SELECT; - + if (info_flags & CAMEL_FOLDER_VIRTUAL) mask |= EM_POPUP_FOLDER_DELETE|EM_POPUP_FOLDER_INFERIORS; - + if ((path = url->fragment ? url->fragment : url->path)) { if ((!strcmp (url->protocol, "vfolder") && !strcmp (path, CAMEL_UNMATCHED_NAME)) || (!strcmp (url->protocol, "maildir") && !strcmp (path, "."))) /* hack for maildir toplevel folder */ mask |= EM_POPUP_FOLDER_DELETE|EM_POPUP_FOLDER_INFERIORS; } } - + camel_url_free(url); done: t->target.mask = mask; @@ -375,13 +375,13 @@ done: /** * em_popup_target_new_attachments: - * @emp: + * @emp: * @attachments: A list of EMsgComposerAttachment objects, reffed for * the list. Will be unreff'd once finished with. - * + * * Owns the list @attachments and their items after they're passed in. - * - * Return value: + * + * Return value: **/ EMPopupTargetAttachments * em_popup_target_new_attachments(EMPopup *emp, GSList *attachments) @@ -399,7 +399,7 @@ em_popup_target_new_attachments(EMPopup *emp, GSList *attachments) mask &= ~ EM_POPUP_ATTACHMENTS_IMAGE; if (CAMEL_IS_MIME_MESSAGE(camel_medium_get_content_object((CamelMedium *) ((EAttachment *) attachments->data)->body))) mask &= ~EM_POPUP_ATTACHMENTS_MESSAGE; - + mask &= ~ EM_POPUP_ATTACHMENTS_ONE; } if (len > 1) @@ -435,7 +435,7 @@ emp_part_popup_set_background(EPopup *ep, EPopupItem *item, void *data) unsigned int i=1; CamelMimePart *part = NULL; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) + if (t->type == EM_POPUP_TARGET_ATTACHMENTS) part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; else part = ((EMPopupTargetPart *) t)->part; @@ -444,7 +444,7 @@ emp_part_popup_set_background(EPopup *ep, EPopupItem *item, void *data) return; filename = g_strdup(camel_mime_part_get_filename(part)); - + /* if filename is blank, create a default filename based on MIME type */ if (!filename || !filename[0]) { CamelContentType *ct; @@ -455,13 +455,13 @@ emp_part_popup_set_background(EPopup *ep, EPopupItem *item, void *data) } e_filename_make_safe(filename); - + path = g_build_filename(g_get_home_dir(), ".gnome2", "wallpapers", filename, NULL); - + extension = strrchr(filename, '.'); if (extension) *extension++ = 0; - + /* if file exists, stick a (number) on the end */ while (g_file_test(path, G_FILE_TEST_EXISTS)) { char *name; @@ -470,35 +470,35 @@ emp_part_popup_set_background(EPopup *ep, EPopupItem *item, void *data) path = g_build_filename(g_get_home_dir(), ".gnome2", "wallpapers", name, NULL); g_free(name); } - + g_free(filename); - + if (em_utils_save_part_to_file(ep->target->widget, path, part)) { gconf = gconf_client_get_default(); - - /* if the filename hasn't changed, blank the filename before + + /* if the filename hasn't changed, blank the filename before * setting it so that gconf detects a change and updates it */ - if ((str = gconf_client_get_string(gconf, "/desktop/gnome/background/picture_filename", NULL)) != NULL + if ((str = gconf_client_get_string(gconf, "/desktop/gnome/background/picture_filename", NULL)) != NULL && strcmp (str, path) == 0) { gconf_client_set_string(gconf, "/desktop/gnome/background/picture_filename", "", NULL); } - + g_free (str); gconf_client_set_string(gconf, "/desktop/gnome/background/picture_filename", path, NULL); - + /* if GNOME currently doesn't display a picture, set to "wallpaper" * display mode, otherwise leave it alone */ - if ((str = gconf_client_get_string(gconf, "/desktop/gnome/background/picture_options", NULL)) == NULL + if ((str = gconf_client_get_string(gconf, "/desktop/gnome/background/picture_options", NULL)) == NULL || strcmp(str, "none") == 0) { gconf_client_set_string(gconf, "/desktop/gnome/background/picture_options", "wallpaper", NULL); } - + gconf_client_suggest_sync(gconf, NULL); - + g_free(str); g_object_unref(gconf); } - + g_free(path); } @@ -509,11 +509,11 @@ emp_part_popup_reply_sender(EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) + if (t->type == EM_POPUP_TARGET_ATTACHMENTS) part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; else part = ((EMPopupTargetPart *) t)->part; - + message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part); em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_SENDER, NULL); } @@ -525,11 +525,11 @@ emp_part_popup_reply_list (EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) + if (t->type == EM_POPUP_TARGET_ATTACHMENTS) part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; else part = ((EMPopupTargetPart *) t)->part; - + message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part); em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_LIST, NULL); } @@ -541,11 +541,11 @@ emp_part_popup_reply_all (EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) + if (t->type == EM_POPUP_TARGET_ATTACHMENTS) part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; else part = ((EMPopupTargetPart *) t)->part; - + message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part); em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_ALL, NULL); } @@ -557,10 +557,10 @@ emp_part_popup_forward (EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) + if (t->type == EM_POPUP_TARGET_ATTACHMENTS) part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; else - part = ((EMPopupTargetPart *) t)->part; + part = ((EMPopupTargetPart *) t)->part; /* TODO: have a emfv specific override so we can get the parent folder uri */ message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *) part); @@ -598,7 +598,7 @@ emp_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data) { EMPopupTargetURI *t = (EMPopupTargetURI *)ep->target; GError *err = NULL; - + gnome_url_show(t->uri, &err); if (err) { g_warning("gnome_url_show: %s", err->message); @@ -653,7 +653,7 @@ emp_apps_open_in(EPopup *ep, EPopupItem *item, void *data) CamelMimePart *part; printf("in emp_apps_open_in\n"); - if (target->type == EM_POPUP_TARGET_ATTACHMENTS) + if (target->type == EM_POPUP_TARGET_ATTACHMENTS) part = ((EAttachment *) ((EMPopupTargetAttachments *) target)->attachments->data)->body; else part = ((EMPopupTargetPart *) target)->part; @@ -663,7 +663,7 @@ emp_apps_open_in(EPopup *ep, EPopupItem *item, void *data) GnomeVFSMimeApplication *app = item->user_data; char *uri; GList *uris = NULL; - + uri = gnome_vfs_get_uri_from_local_path(path); uris = g_list_append(uris, uri); @@ -724,7 +724,7 @@ emp_standard_menu_factory(EPopup *emp, void *data) case EM_POPUP_TARGET_PART: { EMPopupTargetPart *t = (EMPopupTargetPart *)emp->target; mime_type = camel_data_wrapper_get_mime_type((CamelDataWrapper *)t->part); - filename = camel_mime_part_get_filename(t->part); + filename = camel_mime_part_get_filename(t->part); items = emp_standard_object_popups; len = LEN(emp_standard_object_popups); @@ -733,10 +733,10 @@ emp_standard_menu_factory(EPopup *emp, void *data) EMPopupTargetAttachments *t = (EMPopupTargetAttachments *)emp->target; GSList *list = t->attachments; EAttachment *attachment; - + if (g_slist_length(list) != 1 || !((EAttachment *)list->data)->is_available_local) { items = NULL; - len = 0; + len = 0; break; } @@ -747,18 +747,18 @@ emp_standard_menu_factory(EPopup *emp, void *data) items = emp_attachment_object_popups; len = LEN(emp_attachment_object_popups); - break; } + break; } default: items = NULL; len = 0; } - + if (mime_type) { apps = gnome_vfs_mime_get_all_applications(mime_type); - + if (apps == NULL && strcmp(mime_type, "application/octet-stream") == 0) { const char *name_type; - + if (filename) { /* GNOME-VFS will misidentify TNEF attachments as MPEG */ if (!strcmp (filename, "winmail.dat")) @@ -860,7 +860,7 @@ static const EPopupHookTargetMask emph_select_masks[] = { { "add_sender", EM_POPUP_SELECT_ADD_SENDER }, { "folder", EM_POPUP_SELECT_FOLDER }, { "junk", EM_POPUP_SELECT_JUNK }, - { "not_junk", EM_POPUP_SELECT_NOT_JUNK }, + { "not_junk", EM_POPUP_SELECT_NOT_JUNK }, { NULL } }; @@ -933,7 +933,7 @@ GType em_popup_hook_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMPopupHookClass), NULL, NULL, (GClassInitFunc) emph_class_init, NULL, NULL, @@ -943,6 +943,6 @@ em_popup_hook_get_type(void) emph_parent_class = g_type_class_ref(e_popup_hook_get_type()); type = g_type_register_static(e_popup_hook_get_type(), "EMPopupHook", &info, 0); } - + return type; } diff --git a/mail/em-popup.h b/mail/em-popup.h index ea57aa347e..ea44cd4261 100644 --- a/mail/em-popup.h +++ b/mail/em-popup.h @@ -37,7 +37,7 @@ typedef struct _EMPopupClass EMPopupClass; /** * enum _em_popup_target_t - A list of mail popup target types. - * + * * @EM_POPUP_TARGET_SELECT: A selection of messages. * @EM_POPUP_TARGET_URI: A URI. * @EM_POPUP_TARGET_PART: A CamelMimePart message part. @@ -56,7 +56,7 @@ enum _em_popup_target_t { /** * enum _em_popup_target_select_t - EMPopupTargetSelect qualifiers. - * + * * @EM_POPUP_SELECT_ONE: Only one item is selected. * @EM_POPUP_SELECT_MANY: One ore more items are selected. * @EM_POPUP_SELECT_MARK_READ: Message(s) are unseen and can be @@ -85,7 +85,7 @@ enum _em_popup_target_t { * @EM_POPUP_SELECT_FOLDER: A folder is set on the selection. * @EM_POPUP_SELECT_LAST: The last bit used, can be used to add * additional types from derived application code. - * + * **/ enum _em_popup_target_select_t { EM_POPUP_SELECT_ONE = 1<<1, @@ -105,17 +105,17 @@ enum _em_popup_target_select_t { EM_POPUP_SELECT_FOLDER = 1<<15, /* do we have any folder at all? */ EM_POPUP_SELECT_JUNK = 1<<16, EM_POPUP_SELECT_NOT_JUNK = 1<<17, - EM_POPUP_SELECT_LAST = 1<<18, + EM_POPUP_SELECT_LAST = 1<<18, }; /** * enum _em_popup_target_uri_t - EMPopupTargetURI qualifiers. - * + * * @EM_POPUP_URI_HTTP: This is a HTTP or HTTPS url. * @EM_POPUP_URI_MAILTO: This is a MAILTO url. * @EM_POPUP_URI_NOT_MAILTO: This is not a MAILTO url. * @EM_POPUP_URI_CALLTO: This is a CALLTO url. - * + * **/ enum _em_popup_target_uri_t { EM_POPUP_URI_HTTP = 1<<0, @@ -126,10 +126,10 @@ enum _em_popup_target_uri_t { /** * enum _em_popup_target_part_t - EMPopupTargetPart qualifiers. - * + * * @EM_POPUP_PART_MESSAGE: This is a message type. * @EM_POPUP_PART_IMAGE: This is an image type. - * + * **/ enum _em_popup_target_part_t { EM_POPUP_PART_MESSAGE = 1<<0, @@ -138,14 +138,14 @@ enum _em_popup_target_part_t { /** * enum _em_popup_target_folder_t - EMPopupTargetFolder qualifiers. - * + * * @EM_POPUP_FOLDER_FOLDER: This is a normal folder. * @EM_POPUP_FOLDER_STORE: This is a store. * @EM_POPUP_FOLDER_INFERIORS: This folder may have child folders. * @EM_POPUP_FOLDER_DELETE: This folder can be deleted or renamed. * @EM_POPUP_FOLDER_SELECT: This folder exists and can be selected or * opened. - * + * **/ enum _em_popup_target_folder_t { EM_POPUP_FOLDER_FOLDER = 1<<0, /* normal folder */ @@ -159,10 +159,10 @@ enum _em_popup_target_folder_t { /** * enum _em_popup_target_attachments_t - EMPopupTargetAttachments qualifiers. - * + * * @EM_POPUP_ATTACHMENTS_ONE: There is one and only one attachment selected. * @EM_POPUP_ATTACHMENTS_MANY: There is one or more attachments selected. - * + * **/ enum _em_popup_target_attachments_t { EM_POPUP_ATTACHMENTS_ONE = 1<<0, /* only 1 selected */ @@ -180,10 +180,10 @@ typedef struct _EMPopupTargetAttachments EMPopupTargetAttachments; /** * struct _EMPopupTargetURI - An inline URI. - * + * * @target: Superclass. * @uri: The encoded URI to which this target applies. - * + * * Used to represent popup-menu context on any URI object. **/ struct _EMPopupTargetURI { @@ -193,7 +193,7 @@ struct _EMPopupTargetURI { /** * struct _EMPopupTargetSelect - A list of messages. - * + * * @target: Superclass. * @folder: The CamelFolder of the selected messages. * @uri: The encoded URI represending this folder. @@ -212,12 +212,12 @@ struct _EMPopupTargetSelect { /** * struct _EMPopupTargetPart - A Camel object. - * + * * @target: Superclass. * @mime_type: MIME type of the part. This may be a calculated type * not matching the @part's MIME type. * @part: A CamelMimePart representing a message or attachment. - * + * * Used to represent a message part as context for a popup menu. This * is used for both attachments and inline-images. **/ @@ -229,7 +229,7 @@ struct _EMPopupTargetPart { /** * struct _EMPopupTargetFolder - A folder uri. - * + * * @target: Superclass. * @uri: A folder URI. * @@ -242,7 +242,7 @@ struct _EMPopupTargetFolder { /** * struct _EMPopupTargetAttachments - A list of composer attachments. - * + * * @target: Superclass. * @attachments: A GSList list of EMsgComposer attachments. * diff --git a/mail/em-search-context.c b/mail/em-search-context.c index caed0bdc99..48320d2b2c 100644 --- a/mail/em-search-context.c +++ b/mail/em-search-context.c @@ -45,7 +45,7 @@ static void em_search_context_class_init (EMSearchContextClass *klass) { parent_class = g_type_class_ref (RULE_TYPE_CONTEXT); - + ((GObjectClass *)klass)->finalize = em_search_context_finalise; ((RuleContextClass *)klass)->new_element = em_search_new_element; } @@ -55,7 +55,7 @@ em_search_context_init (EMSearchContext *vc) { rule_context_add_part_set ((RuleContext *)vc, "partset", filter_part_get_type (), rule_context_add_part, rule_context_next_part); - + rule_context_add_rule_set ((RuleContext *)vc, "ruleset", filter_rule_get_type (), rule_context_add_rule, rule_context_next_rule); @@ -66,7 +66,7 @@ GType em_search_context_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMSearchContextClass), @@ -79,10 +79,10 @@ em_search_context_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) em_search_context_init, }; - + type = g_type_register_static (RULE_TYPE_CONTEXT, "EMSearchContext", &info, 0); } - + return type; } @@ -90,7 +90,7 @@ em_search_context_get_type (void) * em_search_context_new: * * Create a new EMSearchContext object. - * + * * Return value: A new #EMSearchContext object. **/ EMSearchContext * diff --git a/mail/em-stripsig-filter.c b/mail/em-stripsig-filter.c index b0c0ee28e5..d1c4bb3718 100644 --- a/mail/em-stripsig-filter.c +++ b/mail/em-stripsig-filter.c @@ -48,7 +48,7 @@ CamelType em_stripsig_filter_get_type (void) { static CamelType type = CAMEL_INVALID_TYPE; - + if (type == CAMEL_INVALID_TYPE) { type = camel_type_register (camel_mime_filter_get_type (), "EMStripSigFilter", @@ -59,7 +59,7 @@ em_stripsig_filter_get_type (void) (CamelObjectInitFunc) em_stripsig_filter_init, NULL); } - + return type; } @@ -68,9 +68,9 @@ static void em_stripsig_filter_class_init (EMStripSigFilterClass *klass) { CamelMimeFilterClass *filter_class = (CamelMimeFilterClass *) klass; - + parent_class = CAMEL_MIME_FILTER_CLASS (camel_type_get_global_classfuncs (camel_mime_filter_get_type ())); - + filter_class->reset = filter_reset; filter_class->filter = filter_filter; filter_class->complete = filter_complete; @@ -90,17 +90,17 @@ strip_signature (CamelMimeFilter *filter, char *in, size_t len, size_t prespace, register const char *inptr = in; const char *inend = in + len; const char *start = NULL; - + if (stripsig->midline) { while (inptr < inend && *inptr != '\n') inptr++; - + if (inptr < inend) { stripsig->midline = FALSE; inptr++; } } - + while (inptr < inend) { if ((inend - inptr) >= 4 && !strncmp (inptr, "-- \n", 4)) { start = inptr; @@ -108,24 +108,24 @@ strip_signature (CamelMimeFilter *filter, char *in, size_t len, size_t prespace, } else { while (inptr < inend && *inptr != '\n') inptr++; - + if (inptr == inend) { stripsig->midline = TRUE; break; } - + inptr++; } } - + if (start != NULL) inptr = start; - + if (!flush && inend > inptr) camel_mime_filter_backup (filter, inptr, inend - inptr); else if (!start) inptr = inend; - + *out = in; *outlen = inptr - in; *outprespace = prespace; @@ -150,7 +150,7 @@ static void filter_reset (CamelMimeFilter *filter) { EMStripSigFilter *stripsig = (EMStripSigFilter *) filter; - + stripsig->midline = FALSE; } diff --git a/mail/em-stripsig-filter.h b/mail/em-stripsig-filter.h index cdc3550b06..9e3f42bd85 100644 --- a/mail/em-stripsig-filter.h +++ b/mail/em-stripsig-filter.h @@ -43,13 +43,13 @@ typedef struct _EMStripSigFilterClass EMStripSigFilterClass; struct _EMStripSigFilter { CamelMimeFilter parent_object; - + guint32 midline:1; }; struct _EMStripSigFilterClass { CamelMimeFilterClass parent_class; - + }; diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index 53f3e0fdca..28fc79bfde 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -104,7 +104,7 @@ struct _EMSubscribe { /* pending LISTs, EMSubscribeNode's */ int pending_id; EDList pending; - + /* queue of pending UN/SUBSCRIBEs, EMsg's */ int subscribe_id; EDList subscribe; @@ -181,7 +181,7 @@ struct _zsubscribe_msg { char *path; }; -static void +static void sub_folder_subscribe (struct _mail_msg *mm) { struct _zsubscribe_msg *m = (struct _zsubscribe_msg *) mm; @@ -234,7 +234,7 @@ sub_folder_subscribed (struct _mail_msg *mm) } } -static void +static void sub_folder_free (struct _mail_msg *mm) { struct _zsubscribe_msg *m = (struct _zsubscribe_msg *) mm; @@ -306,7 +306,7 @@ sub_fill_level(EMSubscribe *sub, CamelFolderInfo *info, GtkTreeIter *parent, in gtk_tree_model_get_iter(gtk_tree_view_get_model(sub->tree), &iter, node->path); } - d(printf("flags & CAMEL_FOLDER_NOCHILDREN=%d, f & CAMEL_FOLDER_NOINFERIORS=%d\t fi->full_name=[%s], node->path=%p\n", + d(printf("flags & CAMEL_FOLDER_NOCHILDREN=%d, f & CAMEL_FOLDER_NOINFERIORS=%d\t fi->full_name=[%s], node->path=%p\n", fi->flags & CAMEL_FOLDER_NOCHILDREN, fi->flags & CAMEL_FOLDER_NOINFERIORS, fi->full_name, node->path)); @@ -317,11 +317,11 @@ sub_fill_level(EMSubscribe *sub, CamelFolderInfo *info, GtkTreeIter *parent, in d(printf("scanning child '%s'\n", fi->child->full_name)); sub_fill_level(sub, fi->child, &iter, FALSE); } else if (!(fi->flags & CAMEL_FOLDER_NOCHILDREN)) { - GtkTreeIter new_iter; + GtkTreeIter new_iter; d(printf("flags: CAMEL_FOLDER_NOCHILDREN is not set '%s'\n", fi->full_name)); gtk_tree_store_append(treestore, &new_iter, &iter); gtk_tree_store_set(treestore, &new_iter, 0, 0, 1, "Loading...", 2, NULL, -1); - } + } else { if (pending) e_dlist_addtail(&sub->pending, (EDListNode *)node); @@ -404,8 +404,8 @@ sub_folderinfo_free(struct _mail_msg *mm) if (!m->sub->cancel) sub_editor_busy(m->sub->editor, -1); - /* Now we just load the children on demand, so set the - expand state to true if m->node is not NULL + /* Now we just load the children on demand, so set the + expand state to true if m->node is not NULL */ if (m->node) gtk_tree_view_expand_row(m->sub->tree, m->node->path, FALSE); @@ -501,7 +501,7 @@ sub_selection_changed(GtkTreeSelection *selection, EMSubscribe *sub) } /* double-clicking causes a node item to be evaluated directly */ -static void sub_row_activated(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *col, EMSubscribe *sub) +static void sub_row_activated(GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *col, EMSubscribe *sub) { if (!gtk_tree_view_row_expanded(tree, path)) gtk_tree_view_expand_row(tree, path, FALSE); @@ -548,7 +548,7 @@ sub_row_expanded(GtkTreeView *tree, GtkTreeIter *iter, GtkTreePath *path, EMSubs return; } } - + e_dlist_addhead(&sub->pending, (EDListNode *)node); if (sub->pending_id == -1 @@ -617,12 +617,12 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store) g_str_hash, g_str_equal, (GDestroyNotify) NULL, (GDestroyNotify) sub_node_free); - + model = gtk_tree_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); sub->tree = (GtkTreeView *) gtk_tree_view_new_with_model ((GtkTreeModel *) model); g_object_unref (model); gtk_widget_show ((GtkWidget *)sub->tree); - + sub->widget = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sub->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sub->widget), GTK_SHADOW_IN); @@ -633,11 +633,11 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store) g_object_set(renderer, "activatable", TRUE, NULL); gtk_tree_view_insert_column_with_attributes (sub->tree, -1, _("Subscribed"), renderer, "active", 0, NULL); g_signal_connect(renderer, "toggled", G_CALLBACK(sub_subscribe_toggled), sub); - + renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (sub->tree, -1, _("Folder"), renderer, "text", 1, NULL); gtk_tree_view_set_expander_column(sub->tree, gtk_tree_view_get_column(sub->tree, 1)); - + selection = gtk_tree_view_get_selection (sub->tree); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); gtk_tree_view_set_headers_visible (sub->tree, FALSE); @@ -794,10 +794,10 @@ static void window_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GConfClient *gconf; - + /* save to in-memory variable for current session access */ window_size = *allocation; - + /* save the setting across sessions */ gconf = gconf_client_get_default (); gconf_client_set_int (gconf, "/apps/evolution/mail/subscribe_window/width", window_size.width, NULL); @@ -829,7 +829,7 @@ GtkDialog *em_subscribe_editor_new(void) } se->dialog = (GtkDialog *)glade_xml_get_widget (xml, "subscribe_dialog"); g_signal_connect(se->dialog, "destroy", G_CALLBACK(sub_editor_destroy), se); - + gtk_widget_ensure_style ((GtkWidget *)se->dialog); gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)se->dialog)->action_area, 12); gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *)se->dialog)->vbox, 0); @@ -867,7 +867,7 @@ GtkDialog *em_subscribe_editor_new(void) e_iterator_is_valid (iter); e_iterator_next (iter)) { EAccount *account = (EAccount *) e_iterator_get (iter); - + /* setup url table, and store table? */ if (account->enabled && account->source->url) { d(printf("adding account '%s'\n", account->name)); @@ -883,31 +883,31 @@ GtkDialog *em_subscribe_editor_new(void) gtk_option_menu_set_menu((GtkOptionMenu *)se->optionmenu, menu); g_signal_connect(se->optionmenu, "changed", G_CALLBACK(sub_editor_menu_changed), se); - + if (window_size.width == 0) { /* initialize @window_size with the previous session's size */ GConfClient *gconf; GError *err = NULL; - + gconf = gconf_client_get_default (); - + window_size.width = gconf_client_get_int (gconf, "/apps/evolution/mail/subscribe_window/width", &err); if (err != NULL) { window_size.width = DEFAULT_WIDTH; g_clear_error (&err); } - + window_size.height = gconf_client_get_int (gconf, "/apps/evolution/mail/subscribe_window/height", &err); if (err != NULL) { window_size.height = DEFAULT_HEIGHT; g_clear_error (&err); } - + g_object_unref (gconf); } - + gtk_window_set_default_size ((GtkWindow *) se->dialog, window_size.width, window_size.height); g_signal_connect (se->dialog, "size-allocate", G_CALLBACK (window_size_allocate), NULL); - + return se->dialog; } diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c index 5648efc83e..1224e468bd 100644 --- a/mail/em-sync-stream.c +++ b/mail/em-sync-stream.c @@ -36,7 +36,7 @@ #define LOG_STREAM -#define d(x) +#define d(x) #define EMSS_CLASS(x) ((EMSyncStreamClass *)(((CamelObject *)(x))->klass)) @@ -90,7 +90,7 @@ CamelType em_sync_stream_get_type (void) { static CamelType type = CAMEL_INVALID_TYPE; - + if (type == CAMEL_INVALID_TYPE) { #ifdef LOG_STREAM dolog = getenv("EVOLUTION_MAIL_LOG_HTML") != NULL; @@ -104,7 +104,7 @@ em_sync_stream_get_type (void) (CamelObjectInitFunc) em_sync_stream_init, (CamelObjectFinalizeFunc) em_sync_stream_finalize); } - + return type; } @@ -112,9 +112,9 @@ static void em_sync_stream_class_init (EMSyncStreamClass *klass) { CamelStreamClass *stream_class = CAMEL_STREAM_CLASS (klass); - + parent_class = (CamelStreamClass *) CAMEL_STREAM_TYPE; - + /* virtual method overload */ stream_class->write = stream_write; stream_class->flush = stream_flush; @@ -170,7 +170,7 @@ emcs_gui_received(GIOChannel *source, GIOCondition cond, void *data) #endif break; } - + e_msgport_reply((EMsg *)msg); d(printf("%p: gui sync op jobs done\n", emss)); diff --git a/mail/em-sync-stream.h b/mail/em-sync-stream.h index b48afcc68a..0cb79a468d 100644 --- a/mail/em-sync-stream.h +++ b/mail/em-sync-stream.h @@ -56,7 +56,7 @@ typedef struct { ssize_t (*sync_write) (CamelStream *stream, const char *buffer, size_t n); int (*sync_close) (CamelStream *stream); int (*sync_flush) (CamelStream *stream); - + } EMSyncStreamClass; CamelType em_sync_stream_get_type (void); diff --git a/mail/em-utils.c b/mail/em-utils.c index 894f547c32..498b3cd5a1 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -122,13 +122,13 @@ em_utils_prompt_user(GtkWindow *parent, const char *promptkey, const char *tag, gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0); gtk_widget_show (check); } - + button = gtk_dialog_run ((GtkDialog *) mbox); if (promptkey) gconf_client_set_bool(gconf, promptkey, !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)), NULL); gtk_widget_destroy(mbox); - + return button == GTK_RESPONSE_YES; } @@ -147,13 +147,13 @@ em_utils_uids_copy (GPtrArray *uids) { GPtrArray *copy; int i; - + copy = g_ptr_array_new (); g_ptr_array_set_size (copy, uids->len); - + for (i = 0; i < uids->len; i++) copy->pdata[i] = g_strdup (uids->pdata[i]); - + return copy; } @@ -167,10 +167,10 @@ void em_utils_uids_free (GPtrArray *uids) { int i; - + for (i = 0; i < uids->len; i++) g_free (uids->pdata[i]); - + g_ptr_array_free (uids, TRUE); } @@ -204,7 +204,7 @@ em_utils_configure_account (GtkWidget *parent) gtk_widget_show(emae->editor); gtk_grab_add(emae->editor); gtk_main(); - + return mail_config_is_configured(); } @@ -225,19 +225,19 @@ gboolean em_utils_check_user_can_send_mail (GtkWidget *parent) { EAccount *account; - + if (!mail_config_is_configured ()) { if (!em_utils_configure_account (parent)) return FALSE; } - + if (!(account = mail_config_get_default_account ())) return FALSE; - + /* Check for a transport */ if (!account->transport->url) return FALSE; - + return TRUE; } @@ -249,19 +249,19 @@ static void em_filter_editor_response (GtkWidget *dialog, int button, gpointer user_data) { EMFilterContext *fc; - + if (button == GTK_RESPONSE_OK) { char *user; - + fc = g_object_get_data ((GObject *) dialog, "context"); user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save ((RuleContext *) fc, user); g_free (user); } - + gtk_widget_destroy (dialog); - + filter_editor = NULL; } @@ -285,19 +285,19 @@ em_utils_edit_filters (GtkWidget *parent) const char *base_directory = mail_component_peek_base_directory (mail_component_peek ()); char *user, *system; EMFilterContext *fc; - + if (filter_editor) { gdk_window_raise (GTK_WIDGET (filter_editor)->window); return; } - + fc = em_filter_context_new (); user = g_strdup_printf ("%s/mail/filters.xml", base_directory); system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); rule_context_load ((RuleContext *) fc, system, user); g_free (user); g_free (system); - + if (((RuleContext *) fc)->error) { e_error_run((GtkWindow *)parent, "mail:filter-load-error", ((RuleContext *)fc)->error, NULL); return; @@ -311,15 +311,15 @@ em_utils_edit_filters (GtkWidget *parent) filter_editor = (GtkWidget *) em_filter_editor_new (fc, em_filter_source_element_names); if (parent != NULL) e_dialog_set_transient_for ((GtkWindow *) filter_editor, parent); - + gtk_window_set_title (GTK_WINDOW (filter_editor), _("Message Filters")); g_object_set_data_full ((GObject *) filter_editor, "context", fc, (GtkDestroyNotify) g_object_unref); g_signal_connect (filter_editor, "response", G_CALLBACK (em_filter_editor_response), NULL); gtk_widget_show (GTK_WIDGET (filter_editor)); } -/* - * Picked this from e-d-s/libedataserver/e-data. +/* + * Picked this from e-d-s/libedataserver/e-data. * But it allows more characters to occur in filenames, especially when saving attachment. */ void @@ -331,8 +331,8 @@ em_filename_make_safe (gchar *string) const char *unsafe_chars = "/\":*?<>|\\#"; #else const char *unsafe_chars = "/#"; -#endif - +#endif + g_return_if_fail (string != NULL); p = string; @@ -345,7 +345,7 @@ em_filename_make_safe (gchar *string) * written? */ if (!g_unichar_isprint(c) || ( c < 0xff && strchr (unsafe_chars, c&0xff ))) { - while (ts<p) + while (ts<p) *ts++ = '_'; } } @@ -468,22 +468,22 @@ exit: * @parent: parent window * @filename: filename to save to * @part: part to save - * + * * Save a part's content to a specific file * Creates all needed directories and overwrites without prompting * * Returns %TRUE if saving succeeded, %FALSE otherwise **/ gboolean -em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePart *part) +em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePart *part) { int done; char *dirname; struct stat st; - + if (filename[0] == 0) return FALSE; - + dirname = g_path_get_dirname(filename); if (g_mkdir_with_parents(dirname, 0777) == -1) { e_error_run((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL); @@ -498,15 +498,15 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar return FALSE; } } - + if (g_stat(filename, &st) != -1 && !S_ISREG(st.st_mode)) { e_error_run((GtkWindow *)parent, "mail:no-write-path-notfile", filename, NULL); return FALSE; } - + /* FIXME: This doesn't handle default charsets */ mail_msg_wait(mail_save_part(part, filename, emu_save_part_done, &done, FALSE)); - + return done; } @@ -519,7 +519,7 @@ static void emu_save_messages_response(GtkWidget *filesel, int response, struct _save_messages_data *data) { char *uri; - + if (response == GTK_RESPONSE_OK) { uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel)); @@ -562,7 +562,7 @@ em_utils_save_messages (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids) filesel = e_file_get_save_filesel(parent, _("Save Message..."), NULL, GTK_FILE_CHOOSER_ACTION_SAVE); camel_object_ref(folder); - + data = g_malloc(sizeof(struct _save_messages_data)); data->folder = folder; data->uids = uids; @@ -577,18 +577,18 @@ static void emu_add_address_cb(BonoboListener *listener, const char *name, const CORBA_any *any, CORBA_Environment *ev, void *data) { char *type = bonobo_event_subtype(name); - + if (!strcmp(type, "Destroy")) gtk_widget_destroy((GtkWidget *)data); - + g_free(type); } /** * em_utils_add_address: - * @parent: - * @email: - * + * @parent: + * @email: + * * Add address @email to the addressbook. **/ void em_utils_add_address(struct _GtkWidget *parent, const char *email) @@ -598,16 +598,16 @@ void em_utils_add_address(struct _GtkWidget *parent, const char *email) GtkWidget *control; /*GtkWidget *socket;*/ char *buf; - + cia = camel_internet_address_new (); if (camel_address_decode ((CamelAddress *) cia, email) == -1) { camel_object_unref (cia); return; } - + buf = camel_address_format ((CamelAddress *) cia); camel_object_unref (cia); - + win = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title((GtkWindow *)win, _("Add address")); gtk_window_set_transient_for((GtkWindow *)win, ((GtkWindow *)parent)); @@ -617,9 +617,9 @@ void em_utils_add_address(struct _GtkWidget *parent, const char *email) control = bonobo_widget_new_control("OAFIID:GNOME_Evolution_Addressbook_AddressPopup:" BASE_VERSION, CORBA_OBJECT_NIL); bonobo_widget_set_property((BonoboWidget *)control, "email", TC_CORBA_string, buf, NULL); g_free (buf); - + bonobo_event_source_client_add_listener(bonobo_widget_get_objref((BonoboWidget *)control), emu_add_address_cb, NULL, NULL, win); - + /*socket = find_socket (GTK_CONTAINER (control)); g_object_weak_ref ((GObject *) socket, (GWeakNotify) gtk_widget_destroy, win);*/ @@ -653,11 +653,11 @@ tag_editor_response (GtkWidget *dialog, int button, struct ted_t *ted) CamelTag *tags, *t; GPtrArray *uids; int i; - + if (button == GTK_RESPONSE_OK && (tags = message_tag_editor_get_tag_list (ted->editor))) { folder = ted->folder; uids = ted->uids; - + camel_folder_freeze (folder); for (i = 0; i < uids->len; i++) { CamelMessageInfo *mi = camel_folder_get_message_info(folder, uids->pdata[i]); @@ -669,14 +669,14 @@ tag_editor_response (GtkWidget *dialog, int button, struct ted_t *ted) camel_message_info_free(mi); } } - + camel_folder_thaw (folder); camel_tag_list_free (&tags); if (ted->emfv->preview) em_format_redraw(ted->emfv->preview); } - + gtk_widget_destroy (dialog); } @@ -695,26 +695,26 @@ em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *u GtkWidget *editor; struct ted_t *ted; int i; - + g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - + editor = (GtkWidget *) message_tag_followup_new (); - + if (parent != NULL) e_dialog_set_transient_for ((GtkWindow *) editor, parent); - + camel_object_ref (folder); - + ted = g_new (struct ted_t, 1); ted->emfv = (EMFolderView *) parent; ted->editor = MESSAGE_TAG_EDITOR (editor); ted->folder = folder; ted->uids = uids; - + for (i = 0; i < uids->len; i++) { CamelMessageInfo *info; - + info = camel_folder_get_message_info (folder, uids->pdata[i]); if (info) { message_tag_followup_append_message (MESSAGE_TAG_FOLLOWUP (editor), @@ -723,11 +723,11 @@ em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *u camel_message_info_free(info); } } - + /* special-case... */ if (uids->len == 1) { CamelMessageInfo *info; - + info = camel_folder_get_message_info (folder, uids->pdata[0]); if (info) { const CamelTag *tags = camel_message_info_user_tags(info); @@ -737,10 +737,10 @@ em_utils_flag_for_followup (GtkWidget *parent, CamelFolder *folder, GPtrArray *u camel_message_info_free(info); } } - + g_signal_connect (editor, "response", G_CALLBACK (tag_editor_response), ted); g_object_weak_ref ((GObject *) editor, (GWeakNotify) ted_free, ted); - + gtk_widget_show (editor); } @@ -757,10 +757,10 @@ void em_utils_flag_for_followup_clear (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids) { int i; - + g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - + camel_folder_freeze (folder); for (i = 0; i < uids->len; i++) { CamelMessageInfo *mi = camel_folder_get_message_info(folder, uids->pdata[i]); @@ -773,7 +773,7 @@ em_utils_flag_for_followup_clear (GtkWidget *parent, CamelFolder *folder, GPtrAr } } camel_folder_thaw (folder); - + em_utils_uids_free (uids); } @@ -792,12 +792,12 @@ em_utils_flag_for_followup_completed (GtkWidget *parent, CamelFolder *folder, GP { char *now; int i; - + g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - + now = camel_header_format_date (time (NULL), 0); - + camel_folder_freeze (folder); for (i = 0; i < uids->len; i++) { const char *tag; @@ -811,9 +811,9 @@ em_utils_flag_for_followup_completed (GtkWidget *parent, CamelFolder *folder, GP } } camel_folder_thaw (folder); - + g_free (now); - + em_utils_uids_free (uids); } @@ -834,7 +834,7 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr filtered_stream = camel_stream_filter_new_with_stream(stream); camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)from_filter); camel_object_unref(from_filter); - + for (i=0; i<uids->len; i++) { CamelMimeMessage *message; char *from; @@ -853,7 +853,7 @@ em_utils_write_messages_to_stream(CamelFolder *folder, GPtrArray *uids, CamelStr || camel_data_wrapper_write_to_stream((CamelDataWrapper *)message, (CamelStream *)filtered_stream) == -1 || camel_stream_flush((CamelStream *)filtered_stream) == -1) res = -1; - + g_free(from); camel_object_unref(message); @@ -887,16 +887,16 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream) camel_object_unref(msg); break; } - + camel_folder_append_message(folder, msg, NULL, NULL, ex); camel_object_unref(msg); - + if (camel_exception_is_set (ex)) break; - + camel_mime_parser_step(mp, NULL, NULL); } - + camel_object_unref(mp); if (!camel_exception_is_set(ex)) res = 0; @@ -910,7 +910,7 @@ em_utils_read_messages_from_stream(CamelFolder *folder, CamelStream *stream) * @data: selection data * @folder: folder containign messages to copy into the selection * @uids: uids of the messages to copy into the selection - * + * * Creates a mailbox-format selection. * Warning: Could be BIG! * Warning: This could block the ui for an extended period. @@ -932,8 +932,8 @@ em_utils_selection_set_mailbox(GtkSelectionData *data, CamelFolder *folder, GPtr /** * em_utils_selection_get_mailbox: * @data: selection data - * @folder: - * + * @folder: + * * Receive a mailbox selection/dnd * Warning: Could be BIG! * Warning: This could block the ui for an extended period. @@ -956,9 +956,9 @@ em_utils_selection_get_mailbox(GtkSelectionData *data, CamelFolder *folder) /** * em_utils_selection_get_message: - * @data: - * @folder: - * + * @data: + * @folder: + * * get a message/rfc822 data. **/ void @@ -985,8 +985,8 @@ em_utils_selection_get_message(GtkSelectionData *data, CamelFolder *folder) * em_utils_selection_set_uidlist: * @data: selection data * @uri: - * @uids: - * + * @uids: + * * Sets a "x-uid-list" format selection data. * * FIXME: be nice if this could take a folder argument rather than uri @@ -998,12 +998,12 @@ em_utils_selection_set_uidlist(GtkSelectionData *data, const char *uri, GPtrArra int i; /* format: "uri\0uid1\0uid2\0uid3\0...\0uidn\0" */ - + g_byte_array_append(array, (unsigned char *)uri, strlen(uri)+1); for (i=0; i<uids->len; i++) g_byte_array_append(array, uids->pdata[i], strlen(uids->pdata[i])+1); - + gtk_selection_data_set(data, data->target, 8, array->data, array->len); g_byte_array_free(array, TRUE); } @@ -1012,9 +1012,9 @@ em_utils_selection_set_uidlist(GtkSelectionData *data, const char *uri, GPtrArra * em_utils_selection_get_uidlist: * @data: selection data * @move: do we delete the messages. - * + * * Convert a uid list into a copy/move operation. - * + * * Warning: Could take some time to run. **/ void @@ -1027,7 +1027,7 @@ em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, int mo if (data == NULL || data->data == NULL || data->length == -1) return; - + uids = g_ptr_array_new(); inptr = (char *)data->data; @@ -1060,10 +1060,10 @@ em_utils_selection_get_uidlist(GtkSelectionData *data, CamelFolder *dest, int mo /** * em_utils_selection_set_urilist: - * @data: - * @folder: - * @uids: - * + * @data: + * @folder: + * @uids: + * * Set the selection data @data to a uri which points to a file, which is * a berkely mailbox format mailbox. The file is automatically cleaned * up when the application quits. @@ -1101,7 +1101,7 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr tmpfile = g_build_filename(tmpdir, file, NULL); g_free(tmpdir); g_free(file); - + fd = g_open(tmpfile, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0666); if (fd == -1) { g_free(tmpfile); @@ -1129,10 +1129,10 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr /** * em_utils_selection_set_urilist: - * @data: - * @folder: - * @uids: - * + * @data: + * @folder: + * @uids: + * * Get the selection data @data from a uri list which points to a * file, which is a berkely mailbox format mailbox. The file is * automatically cleaned up when the application quits. @@ -1182,13 +1182,13 @@ emu_save_part_done(CamelMimePart *part, char *name, int done, void *data) /** * em_utils_temp_save_part: - * @parent: - * @part: + * @parent: + * @part: * @mode: readonly or not. - * + * * Save a part's content to a temporary file, and return the * filename. - * + * * Return value: NULL if anything failed. **/ char * @@ -1219,7 +1219,7 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode) path = g_build_filename(tmpdir, filename, NULL); g_free(tmpdir); g_free(mfilename); - + /* FIXME: This doesn't handle default charsets */ if (mode) mail_msg_wait(mail_save_part(part, path, emu_save_part_done, &done, TRUE)); @@ -1241,7 +1241,7 @@ em_utils_temp_save_part(GtkWidget *parent, CamelMimePart *part, gboolean mode) * @uri: uri for this folder, if known * * Decides if @folder is a Drafts folder. - * + * * Returns %TRUE if this is a Drafts folder or %FALSE otherwise. **/ gboolean @@ -1252,18 +1252,18 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri) EIterator *iter; int is = FALSE; char *drafts_uri; - + if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) return TRUE; if (uri == NULL) return FALSE; - + accounts = mail_config_get_accounts(); iter = e_list_get_iterator((EList *)accounts); while (e_iterator_is_valid(iter)) { account = (EAccount *)e_iterator_get(iter); - + if (account->drafts_folder_uri) { drafts_uri = em_uri_to_camel (account->drafts_folder_uri); if (camel_store_folder_uri_equal (folder->parent_store, drafts_uri, uri)) { @@ -1273,12 +1273,12 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri) } g_free (drafts_uri); } - + e_iterator_next(iter); } - + g_object_unref(iter); - + return is; } @@ -1288,7 +1288,7 @@ em_utils_folder_is_drafts(CamelFolder *folder, const char *uri) * @uri: uri for this folder, if known * * Decides if @folder is a Sent folder - * + * * Returns %TRUE if this is a Sent folder or %FALSE otherwise. **/ gboolean @@ -1299,18 +1299,18 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri) EIterator *iter; int is = FALSE; char *sent_uri; - + if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT)) return TRUE; - + if (uri == NULL) return FALSE; - + accounts = mail_config_get_accounts(); iter = e_list_get_iterator((EList *)accounts); while (e_iterator_is_valid(iter)) { account = (EAccount *)e_iterator_get(iter); - + if (account->sent_folder_uri) { sent_uri = em_uri_to_camel (account->sent_folder_uri); if (camel_store_folder_uri_equal (folder->parent_store, sent_uri, uri)) { @@ -1320,12 +1320,12 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri) } g_free (sent_uri); } - + e_iterator_next(iter); } - + g_object_unref(iter); - + return is; } @@ -1335,7 +1335,7 @@ em_utils_folder_is_sent(CamelFolder *folder, const char *uri) * @uri: uri for this folder, if known * * Decides if @folder is an Outbox folder - * + * * Returns %TRUE if this is an Outbox folder or %FALSE otherwise. **/ gboolean @@ -1347,9 +1347,9 @@ em_utils_folder_is_outbox(CamelFolder *folder, const char *uri) /** * em_utils_adjustment_page: - * @adj: - * @down: - * + * @adj: + * @down: + * * Move an adjustment up/down forward/back one page. **/ void @@ -1437,9 +1437,9 @@ emu_proxy_setup(void *data) /** * em_utils_get_proxy_uri: - * + * * Get the system proxy uri. - * + * * Return value: Must be freed when finished with. **/ char * @@ -1469,7 +1469,7 @@ em_utils_get_proxy_uri(void) * then it will be used as an attribution string, and the * content will be cited. Otherwise no citation or attribution * will be performed. - * + * * Return Value: The part in displayable html format. **/ char * @@ -1479,11 +1479,11 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source) CamelStreamMem *mem; GByteArray *buf; char *text; - + buf = g_byte_array_new (); mem = (CamelStreamMem *) camel_stream_mem_new (); camel_stream_mem_set_byte_array (mem, buf); - + emfq = em_format_quote_new(NULL, (CamelStream *)mem, 0); ((EMFormat *) emfq)->composer = TRUE; em_format_set_session((EMFormat *)emfq, session); @@ -1511,14 +1511,14 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source) /** * em_utils_message_to_html: * @message: - * @credits: + * @credits: * @flags: EMFormatQuote flags * @len: * @source: * * Convert a message to html, quoting if the @credits attribution * string is given. - * + * * Return value: The html version. **/ char * @@ -1534,13 +1534,13 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 camel_stream_mem_set_byte_array (mem, buf); emfq = em_format_quote_new(credits, (CamelStream *)mem, flags); - ((EMFormat *) emfq)->composer = TRUE; + ((EMFormat *) emfq)->composer = TRUE; em_format_set_session((EMFormat *)emfq, session); - + if (!source) { GConfClient *gconf; char *charset; - + /* FIXME: we should be getting this from the current view, not the global setting. */ gconf = gconf_client_get_default (); charset = gconf_client_get_string (gconf, "/apps/evolution/mail/display/charset", NULL); @@ -1548,7 +1548,7 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 g_object_unref (gconf); g_free (charset); } - + em_format_format_clone((EMFormat *)emfq, NULL, NULL, message, source); g_object_unref (emfq); @@ -1581,7 +1581,7 @@ em_utils_expunge_folder (GtkWidget *parent, CamelFolder *folder) if (!em_utils_prompt_user ((GtkWindow *) parent, "/apps/evolution/mail/prompts/expunge", "mail:ask-expunge", name, NULL)) return; - + mail_expunge_folder(folder, NULL, NULL); } @@ -1599,18 +1599,18 @@ em_utils_empty_trash (GtkWidget *parent) EAccount *account; EIterator *iter; CamelException ex; - + if (!em_utils_prompt_user((GtkWindow *) parent, "/apps/evolution/mail/prompts/empty_trash", "mail:ask-empty-trash", NULL)) return; - + camel_exception_init (&ex); - + /* expunge all remote stores */ accounts = mail_config_get_accounts (); iter = e_list_get_iterator ((EList *) accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + /* make sure this is a valid source */ if (account->enabled && account->source->url) { provider = camel_provider_get(account->source->url, &ex); @@ -1621,16 +1621,16 @@ em_utils_empty_trash (GtkWidget *parent) mail_empty_trash (account, NULL, NULL); } } - + /* clear the exception for the next round */ camel_exception_clear (&ex); } - + e_iterator_next (iter); } - + g_object_unref (iter); - + /* Now empty the local trash folder */ mail_empty_trash (NULL, NULL, NULL); } @@ -1640,23 +1640,23 @@ em_utils_folder_name_from_uri (const char *uri) { CamelURL *url; char *folder_name = NULL; - + if (uri == NULL || (url = camel_url_new (uri, NULL)) == NULL) return NULL; - + if (url->fragment) folder_name = url->fragment; else if (url->path) folder_name = url->path + 1; - + if (folder_name == NULL) { camel_url_free (url); return NULL; } - + folder_name = g_strdup (folder_name); camel_url_free (url); - + return folder_name; } @@ -1711,7 +1711,7 @@ char *em_uri_from_camel(const char *curi) } else { euri = g_strdup_printf("email://%s/", uid); } - + d(printf("em uri from camel '%s' -> '%s'\n", curi, euri)); camel_url_free(curl); @@ -1788,7 +1788,7 @@ char *em_uri_to_camel(const char *euri) service = account->source; if (!(provider = camel_provider_get (service->url, NULL))) return g_strdup (euri); - + curl = camel_url_new(service->url, NULL); if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) camel_url_set_fragment(curl, eurl->path[0]=='/'?eurl->path+1:eurl->path); @@ -2030,7 +2030,7 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) photo = e_contact_get (contact, E_CONTACT_LOGO); g_list_foreach (contacts, (GFunc)g_object_unref, NULL); g_list_free (contacts); - } + } g_object_unref (source); /* Is it? */ g_object_unref(book); } @@ -2048,8 +2048,8 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) /* Form a mime part out of the photo */ part = camel_mime_part_new(); - camel_mime_part_set_content(part, - (const char *) photo->data.inlined.data, + camel_mime_part_set_content(part, + (const char *) photo->data.inlined.data, photo->data.inlined.length, "image/jpeg"); e_contact_photo_free (photo); @@ -2059,10 +2059,10 @@ em_utils_contact_photo (struct _CamelInternetAddress *cia, gboolean local) /** * em_utils_snoop_type: - * @part: - * + * @part: + * * Tries to snoop the mime type of a part. - * + * * Return value: NULL if unknown (more likely application/octet-stream). **/ const char * @@ -2070,16 +2070,16 @@ em_utils_snoop_type(CamelMimePart *part) { const char *filename, *name_type = NULL, *magic_type = NULL; CamelDataWrapper *dw; - + filename = camel_mime_part_get_filename (part); if (filename) { /* GNOME-VFS will misidentify TNEF attachments as MPEG */ if (!strcmp (filename, "winmail.dat")) return "application/vnd.ms-tnef"; - + name_type = gnome_vfs_mime_type_from_name(filename); } - + dw = camel_medium_get_content_object((CamelMedium *)part); if (!camel_data_wrapper_is_offline(dw)) { CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new(); @@ -2097,7 +2097,7 @@ em_utils_snoop_type(CamelMimePart *part) * that instead and if it returns "application/octet-stream" * try to do better with the filename check. */ - + if (magic_type) { if (name_type && (!strcmp(magic_type, "text/plain") diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-context.c index fda942869c..36ef03cf57 100644 --- a/mail/em-vfolder-context.c +++ b/mail/em-vfolder-context.c @@ -45,7 +45,7 @@ static void em_vfolder_context_class_init(EMVFolderContextClass *klass) { parent_class = g_type_class_ref(RULE_TYPE_CONTEXT); - + ((GObjectClass *)klass)->finalize = em_vfolder_context_finalise; ((RuleContextClass *)klass)->new_element = vfolder_new_element; } @@ -55,7 +55,7 @@ em_vfolder_context_init(EMVFolderContext *vc) { rule_context_add_part_set((RuleContext *) vc, "partset", filter_part_get_type(), rule_context_add_part, rule_context_next_part); - + rule_context_add_rule_set((RuleContext *) vc, "ruleset", em_vfolder_rule_get_type(), rule_context_add_rule, rule_context_next_rule); @@ -66,7 +66,7 @@ GType em_vfolder_context_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMVFolderContextClass), @@ -79,10 +79,10 @@ em_vfolder_context_get_type(void) 0, /* n_preallocs */ (GInstanceInitFunc) em_vfolder_context_init, }; - + type = g_type_register_static(RULE_TYPE_CONTEXT, "EMVFolderContext", &info, 0); } - + return type; } @@ -90,7 +90,7 @@ em_vfolder_context_get_type(void) * em_vfolder_context_new: * * Create a new EMVFolderContext object. - * + * * Return value: A new #EMVFolderContext object. **/ EMVFolderContext * diff --git a/mail/em-vfolder-context.h b/mail/em-vfolder-context.h index 2330179a4c..d47730f41f 100644 --- a/mail/em-vfolder-context.h +++ b/mail/em-vfolder-context.h @@ -36,7 +36,7 @@ typedef struct _EMVFolderContextClass EMVFolderContextClass; struct _EMVFolderContext { RuleContext parent_object; - + }; struct _EMVFolderContextClass { diff --git a/mail/em-vfolder-editor.c b/mail/em-vfolder-editor.c index 05ee9cc13e..d077170824 100644 --- a/mail/em-vfolder-editor.c +++ b/mail/em-vfolder-editor.c @@ -50,11 +50,11 @@ em_vfolder_editor_class_init (EMVFolderEditorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); RuleEditorClass *re_class = (RuleEditorClass *) klass; - + parent_class = g_type_class_ref (rule_editor_get_type ()); - + gobject_class->finalize = em_vfolder_editor_finalise; - + /* override methods */ re_class->create_rule = create_rule; } @@ -69,7 +69,7 @@ GtkType em_vfolder_editor_get_type (void) { static GtkType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (EMVFolderEditorClass), @@ -82,10 +82,10 @@ em_vfolder_editor_get_type (void) 0, /* n_preallocs */ (GInstanceInitFunc) em_vfolder_editor_init, }; - + type = g_type_register_static (RULE_TYPE_EDITOR, "EMVFolderEditor", &info, 0); } - + return type; } @@ -93,7 +93,7 @@ em_vfolder_editor_get_type (void) * em_vfolder_editor_new: * * Create a new EMVFolderEditor object. - * + * * Return value: A new #EMVFolderEditor object. **/ EMVFolderEditor * @@ -102,7 +102,7 @@ em_vfolder_editor_new (EMVFolderContext *vc) EMVFolderEditor *ve = (EMVFolderEditor *) g_object_new (em_vfolder_editor_get_type(), NULL); GladeXML *gui; char *gladefile; - + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "filter.glade", NULL); @@ -112,7 +112,7 @@ em_vfolder_editor_new (EMVFolderContext *vc) rule_editor_construct ((RuleEditor *) ve, (RuleContext *) vc, gui, "incoming", _("Search _Folders")); gtk_widget_hide(glade_xml_get_widget (gui, "filter_source")); g_object_unref (gui); - + return ve; } @@ -121,11 +121,11 @@ create_rule (RuleEditor *re) { FilterRule *rule = filter_rule_new (); FilterPart *part; - + /* create a rule with 1 part in it */ rule = (FilterRule *) em_vfolder_rule_new (); part = rule_context_next_part (re->context, NULL); filter_rule_add_part (rule, filter_part_clone (part)); - + return rule; } diff --git a/mail/em-vfolder-editor.h b/mail/em-vfolder-editor.h index 25497f4c9c..65500ba374 100644 --- a/mail/em-vfolder-editor.h +++ b/mail/em-vfolder-editor.h @@ -37,7 +37,7 @@ typedef struct _EMVFolderEditorClass EMVFolderEditorClass; struct _EMVFolderEditor { RuleEditor parent_object; - + }; struct _EMVFolderEditorClass { diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index 15b93f24b0..d3b3ecc0e8 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -68,7 +68,7 @@ GType em_vfolder_rule_get_type(void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof(EMVFolderRuleClass), @@ -81,10 +81,10 @@ em_vfolder_rule_get_type(void) 0, /* n_preallocs */ (GInstanceInitFunc)em_vfolder_rule_init, }; - + type = g_type_register_static(FILTER_TYPE_RULE, "EMVFolderRule", &info, 0); } - + return type; } @@ -93,11 +93,11 @@ em_vfolder_rule_class_init(EMVFolderRuleClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); FilterRuleClass *fr_class =(FilterRuleClass *)klass; - + parent_class = g_type_class_ref(FILTER_TYPE_RULE); - + object_class->finalize = em_vfolder_rule_finalise; - + /* override methods */ fr_class->validate = validate; fr_class->eq = vfolder_eq; @@ -119,10 +119,10 @@ static void em_vfolder_rule_finalise(GObject *obj) { EMVFolderRule *vr =(EMVFolderRule *)obj; - + g_list_foreach(vr->sources, (GFunc)g_free, NULL); g_list_free(vr->sources); - + G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -130,7 +130,7 @@ em_vfolder_rule_finalise(GObject *obj) * em_vfolder_rule_new: * * Create a new EMVFolderRule object. - * + * * Return value: A new #EMVFolderRule object. **/ EMVFolderRule * @@ -144,9 +144,9 @@ em_vfolder_rule_add_source(EMVFolderRule *vr, const char *uri) { g_return_if_fail (EM_IS_VFOLDER_RULE(vr)); g_return_if_fail (uri); - + vr->sources = g_list_append(vr->sources, g_strdup(uri)); - + filter_rule_emit_changed((FilterRule *)vr); } @@ -154,9 +154,9 @@ const char * em_vfolder_rule_find_source(EMVFolderRule *vr, const char *uri) { GList *l; - + g_return_val_if_fail (EM_IS_VFOLDER_RULE(vr), NULL); - + /* only does a simple string or address comparison, should probably do a decoded url comparison */ l = vr->sources; @@ -165,7 +165,7 @@ em_vfolder_rule_find_source(EMVFolderRule *vr, const char *uri) return l->data; l = l->next; } - + return NULL; } @@ -173,9 +173,9 @@ void em_vfolder_rule_remove_source(EMVFolderRule *vr, const char *uri) { char *found; - + g_return_if_fail (EM_IS_VFOLDER_RULE(vr)); - + found =(char *)em_vfolder_rule_find_source(vr, uri); if (found) { vr->sources = g_list_remove(vr->sources, found); @@ -188,7 +188,7 @@ const char * em_vfolder_rule_next_source(EMVFolderRule *vr, const char *last) { GList *node; - + if (last == NULL) { node = vr->sources; } else { @@ -198,10 +198,10 @@ em_vfolder_rule_next_source(EMVFolderRule *vr, const char *last) else node = g_list_next(node); } - + if (node) return (const char *)node->data; - + return NULL; } @@ -209,13 +209,13 @@ static int validate(FilterRule *fr) { g_return_val_if_fail(fr != NULL, 0); - + if (!fr->name || !*fr->name) { /* FIXME: set a parent window? */ e_error_run(NULL, "mail:no-name-vfolder", NULL); return 0; } - + /* We have to have at least one source set in the "specific" case. Do not translate this string! */ if (((EMVFolderRule *)fr)->with == EM_VFOLDER_RULE_WITH_SPECIFIC && ((EMVFolderRule *)fr)->sources == NULL) { @@ -223,7 +223,7 @@ validate(FilterRule *fr) e_error_run(NULL, "mail:vfolder-no-source", NULL); return 0; } - + return FILTER_RULE_CLASS(parent_class)->validate(fr); } @@ -231,15 +231,15 @@ static int list_eq(GList *al, GList *bl) { int truth = TRUE; - + while (truth && al && bl) { char *a = al->data, *b = bl->data; - + truth = strcmp(a, b)== 0; al = al->next; bl = bl->next; } - + return truth && al == NULL && bl == NULL; } @@ -271,7 +271,7 @@ xml_encode(FilterRule *fr) xmlAddChild(set, work); l = l->next; } - + return node; } @@ -297,11 +297,11 @@ xml_decode(FilterRule *fr, xmlNodePtr node, struct _RuleContext *f) int result; EMVFolderRule *vr =(EMVFolderRule *)fr; char *tmp; - + result = FILTER_RULE_CLASS(parent_class)->xml_decode(fr, node, f); if (result != 0) return result; - + /* handle old format file, vfolder source is in filterrule */ if (strcmp(fr->source, "incoming")!= 0) { set_with(vr, fr->source); @@ -339,20 +339,20 @@ rule_copy(FilterRule *dest, FilterRule *src) { EMVFolderRule *vdest, *vsrc; GList *node; - + vdest =(EMVFolderRule *)dest; vsrc =(EMVFolderRule *)src; - + if (vdest->sources) { g_list_foreach(vdest->sources, (GFunc)g_free, NULL); g_list_free(vdest->sources); vdest->sources = NULL; } - + node = vsrc->sources; while (node) { char *uri = node->data; - + vdest->sources = g_list_append(vdest->sources, g_strdup(uri)); node = node->next; } @@ -402,13 +402,13 @@ select_source(GtkWidget *list, struct _source_data *data) GtkTreeViewColumn *column; GtkTreePath *path; GtkTreeIter iter; - + gtk_tree_view_get_cursor(data->list, &path, &column); gtk_tree_model_get_iter(GTK_TREE_MODEL(data->model), &iter, path); gtk_tree_path_free(path); - + gtk_tree_model_get(GTK_TREE_MODEL(data->model), &iter, 0, &data->current, -1); - + set_sensitive(data); } @@ -417,7 +417,7 @@ select_source_with_changed(GtkWidget *widget, struct _source_data *data) { em_vfolder_rule_with_t with = 0; GSList *group = NULL; - gint i = 0; + gint i = 0; if ( !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) ) return; @@ -425,7 +425,7 @@ select_source_with_changed(GtkWidget *widget, struct _source_data *data) group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); for (i=0; i< g_slist_length(group); i++) { - if ( g_slist_nth_data (group, with = i) == widget ) + if ( g_slist_nth_data (group, with = i) == widget ) break; } @@ -481,11 +481,11 @@ vfr_folder_response(GtkWidget *dialog, gint button, struct _source_data *data) char *urinice, *euri; GtkTreeSelection *selection; GtkTreeIter iter; - + euri = em_uri_from_camel(uri); data->vr->sources = g_list_append(data->vr->sources, euri); - + gtk_list_store_append(data->model, &iter); urinice = format_source(euri); gtk_list_store_set(data->model, &iter, 0, urinice, 1, euri, -1); @@ -505,10 +505,10 @@ source_add(GtkWidget *widget, struct _source_data *data) { EMFolderTree *emft; GtkWidget *dialog; - + emft =(EMFolderTree *)em_folder_tree_new_with_model(mail_component_peek_tree_model(mail_component_peek())); em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOSELECT); - + dialog = em_folder_selector_new(emft, EM_FOLDER_SELECTOR_CAN_CREATE, _("Select Folder"), NULL, _("_Add")); gtk_window_set_transient_for((GtkWindow *)dialog, (GtkWindow *)gtk_widget_get_toplevel(widget)); gtk_window_set_modal((GtkWindow *)dialog, TRUE); @@ -525,44 +525,44 @@ source_remove(GtkWidget *widget, struct _source_data *data) GtkTreeIter iter; int index = 0; int n; - + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(data->list)); - + source = NULL; while ((source = em_vfolder_rule_next_source(data->vr, source))) { path = gtk_tree_path_new(); gtk_tree_path_append_index(path, index); - + if (gtk_tree_selection_path_is_selected(selection, path)) { gtk_tree_model_get_iter(GTK_TREE_MODEL(data->model), &iter, path); - + em_vfolder_rule_remove_source(data->vr, source); gtk_list_store_remove(data->model, &iter); gtk_tree_path_free(path); - + /* now select the next rule */ n = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(data->model), NULL); index = index >= n ? n - 1 : index; - + if (index >= 0) { path = gtk_tree_path_new(); gtk_tree_path_append_index(path, index); gtk_tree_model_get_iter(GTK_TREE_MODEL(data->model), &iter, path); gtk_tree_path_free(path); - + gtk_tree_selection_select_iter(selection, &iter); gtk_tree_model_get(GTK_TREE_MODEL(data->model), &iter, 0, &data->current, -1); } else { data->current = NULL; } - + break; } - + index++; gtk_tree_path_free(path); } - + set_sensitive(data); } @@ -577,32 +577,32 @@ em_vfolder_editor_sourcelist_new(char *widget_name, char *string1, char *string2 GtkTreeSelection *selection; GtkCellRenderer *renderer; GtkListStore *model; - + scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - + model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); table = gtk_tree_view_new_with_model((GtkTreeModel *)model); gtk_tree_view_set_headers_visible((GtkTreeView *)table, FALSE); - + renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes((GtkTreeView *)table, -1, _("Search Folder source"), renderer, "text", 0, NULL); - + selection = gtk_tree_view_get_selection((GtkTreeView *)table); gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - + gtk_container_add(GTK_CONTAINER(scrolled), table); - + g_object_set_data((GObject *)scrolled, "table", table); g_object_set_data((GObject *)scrolled, "model", model); - + gtk_widget_show(scrolled); gtk_widget_show(table); - + g_object_unref (model); return scrolled; @@ -620,13 +620,13 @@ get_widget(FilterRule *fr, RuleContext *rc) GladeXML *gui; int i; char *gladefile; - + widget = FILTER_RULE_CLASS(parent_class)->get_widget(fr, rc); - + data = g_malloc0(sizeof(*data)); data->rc = rc; data->vr = vr; - + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "mail-dialogs.glade", NULL); @@ -634,18 +634,18 @@ get_widget(FilterRule *fr, RuleContext *rc) g_free (gladefile); frame = glade_xml_get_widget(gui, "vfolder_source_frame"); - + g_object_set_data_full((GObject *)frame, "data", data, g_free); - + for(i = 0; i < BUTTON_LAST; i++) { data->buttons[i] =(GtkButton *)glade_xml_get_widget(gui, edit_buttons[i].name); g_signal_connect(data->buttons[i], "clicked", edit_buttons[i].func, data); } - + list = glade_xml_get_widget(gui, "source_list"); data->list =(GtkTreeView *)g_object_get_data((GObject *)list, "table"); data->model =(GtkListStore *)g_object_get_data((GObject *)list, "model"); - + source = NULL; while ((source = em_vfolder_rule_next_source(vr, source))) { char *nice = format_source(source); @@ -654,9 +654,9 @@ get_widget(FilterRule *fr, RuleContext *rc) gtk_list_store_set(data->model, &iter, 0, nice, 1, source, -1); g_free(nice); } - + g_signal_connect(data->list, "cursor-changed", G_CALLBACK(select_source), data); - + rb = (GtkRadioButton *)glade_xml_get_widget (gui, "local_rb"); g_signal_connect (GTK_WIDGET(rb), "toggled", G_CALLBACK(select_source_with_changed), data); @@ -674,12 +674,12 @@ get_widget(FilterRule *fr, RuleContext *rc) rb = g_slist_nth_data(gtk_radio_button_get_group (rb), vr->with); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb), TRUE); gtk_signal_emit_by_name (GTK_OBJECT (rb), "toggled"); - + set_sensitive(data); - + g_object_unref(gui); gtk_box_pack_start(GTK_BOX(widget), frame, TRUE, TRUE, 3); - + return widget; } diff --git a/mail/em-vfolder-rule.h b/mail/em-vfolder-rule.h index 67721605ce..e9e7f6d537 100644 --- a/mail/em-vfolder-rule.h +++ b/mail/em-vfolder-rule.h @@ -46,7 +46,7 @@ typedef enum _em_vfolder_rule_with_t em_vfolder_rule_with_t; struct _EMVFolderRule { FilterRule rule; - + em_vfolder_rule_with_t with; GList *sources; /* uri's of the source folders */ }; diff --git a/mail/em-vfs-stream.c b/mail/em-vfs-stream.c index 6b528772f0..290ea86a4d 100644 --- a/mail/em-vfs-stream.c +++ b/mail/em-vfs-stream.c @@ -42,7 +42,7 @@ #define LOG_STREAM -#define d(x) +#define d(x) #define EMVS_CLASS(x) ((EMVFSStreamClass *)(((CamelObject *)(x))->klass)) @@ -293,7 +293,7 @@ CamelType em_vfs_stream_get_type (void) { static CamelType type = CAMEL_INVALID_TYPE; - + if (type == CAMEL_INVALID_TYPE) { parent_class = (CamelStreamClass *)camel_seekable_stream_get_type(); type = camel_type_register ((CamelType)parent_class, @@ -305,17 +305,17 @@ em_vfs_stream_get_type (void) (CamelObjectInitFunc) em_vfs_stream_init, (CamelObjectFinalizeFunc) em_vfs_stream_finalize); } - + return type; } /** * emvfs_stream_new: - * @handle: - * + * @handle: + * * Create a new camel stream from a GnomeVFS handle. The camel stream * will own the handle from now on. - * + * * Return value: A CamelStream that will talk to @handle. This function cannot fail. **/ EMVFSStream * diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c index 35fd28c5b5..1fafedc0a2 100644 --- a/mail/importers/elm-importer.c +++ b/mail/importers/elm-importer.c @@ -1,20 +1,20 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* elm-importer.c - * + * * Authors: Iain Holmes <iain@ximian.com> * Michael Zucchi <notzed@ximian.com> * * Copyright 2001 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * 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 General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 @@ -303,7 +303,7 @@ mail_importer_elm_import(EImport *ei, EImportTarget *target) m->status = camel_operation_new(elm_status, m); id = m->msg.seq; - + e_thread_put(mail_thread_queued, (EMsg *)m); return id; diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c index b12ecca3a2..1ad64b91e3 100644 --- a/mail/importers/evolution-mbox-importer.c +++ b/mail/importers/evolution-mbox-importer.c @@ -77,7 +77,7 @@ static GtkWidget * mbox_getwidget(EImport *ei, EImportTarget *target, EImportImporter *im) { GtkWidget *hbox, *w; - + hbox = gtk_hbox_new(FALSE, 0); w = gtk_label_new(_("Destination folder:")); @@ -124,7 +124,7 @@ mbox_supported(EImport *ei, EImportTarget *target, EImportImporter *im) close(fd); } - return ret; + return ret; } static void diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c index 4e36ebd7fa..5905080735 100644 --- a/mail/importers/mail-importer.c +++ b/mail/importers/mail-importer.c @@ -56,10 +56,10 @@ /** * mail_importer_make_local_folder: - * @folderpath: - * + * @folderpath: + * * Check a local folder exists at path @folderpath, and if not, create it. - * + * * Return value: The physical uri of the folder, or NULL if the folder did * not exist and could not be created. **/ @@ -86,12 +86,12 @@ mail_importer_add_line (MailImporter *importer, CamelMimeMessage *msg; CamelMessageInfo *info; CamelException *ex; - + if (importer->mstream == NULL) importer->mstream = CAMEL_STREAM_MEM (camel_stream_mem_new ()); camel_stream_write (CAMEL_STREAM (importer->mstream), str, strlen (str)); - + if (finished == FALSE) return; @@ -102,7 +102,7 @@ mail_importer_add_line (MailImporter *importer, msg = camel_mime_message_new (); camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), CAMEL_STREAM (importer->mstream)); - + camel_object_unref (importer->mstream); importer->mstream = NULL; @@ -133,7 +133,7 @@ struct _BonoboObject *mail_importer_factory_cb(struct _BonoboGenericFactory *fac struct _import_mbox_msg { struct _mail_msg msg; - + char *path; char *uri; CamelOperation *cancel; @@ -298,7 +298,7 @@ static void import_mbox_free (struct _mail_msg *mm) { struct _import_mbox_msg *m = (struct _import_mbox_msg *)mm; - + if (m->cancel) camel_operation_unref(m->cancel); g_free(m->uri); @@ -436,11 +436,11 @@ import_folders_rec(struct _import_folders_data *m, const char *filepath, const c /** * mail_importer_import_folders_sync: - * @filepath: - * @: - * @flags: - * @cancel: - * + * @filepath: + * @: + * @flags: + * @cancel: + * * import from a base path @filepath into the root local folder tree, * scanning all sub-folders. * diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index 4487d51f0e..97f3349e66 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -1,22 +1,22 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* pine-importer.c - * - * Authors: + * + * Authors: * Iain Holmes <iain@ximian.com> * Michael Zucchi <notzed@ximian.com> * * Copyright 2001 Ximian, Inc. (www.ximian.com) * Copyright 2004 Novell, Inc. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * 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 General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 @@ -177,7 +177,7 @@ import_contacts(void) printf("importing pine addressbook\n"); if (!e_book_get_addressbooks(&source_list, NULL)) - return; + return; name = g_build_filename(g_get_home_dir(), ".addressbook", NULL); fp = fopen(name, "r"); @@ -192,7 +192,7 @@ import_contacts(void) g_warning ("Could not create EBook."); return; } - + e_book_open(book, TRUE, NULL); g_object_unref(primary); g_object_unref(source_list); @@ -349,7 +349,7 @@ mail_importer_pine_import(EImport *ei, EImportTarget *target) m->status = camel_operation_new(pine_status, m); id = m->msg.seq; - + e_thread_put(mail_thread_queued, (EMsg *)m); return id; diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index ce43d1ac76..675dbcc9bc 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -66,7 +66,7 @@ rule_match_recipients (RuleContext *context, FilterRule *rule, CamelInternetAddr int i; const char *real, *addr; char *namestr; - + /* address types etc should handle multiple values */ for (i = 0; camel_internet_address_get (iaddr, i, &real, &addr); i++) { part = rule_context_create_part (context, "to"); @@ -75,7 +75,7 @@ rule_match_recipients (RuleContext *context, FilterRule *rule, CamelInternetAddr filter_option_set_current ((FilterOption *)element, "contains"); element = filter_part_find_element (part, "recipient"); filter_input_set_value ((FilterInput *)element, addr); - + namestr = g_strdup_printf (_("Mail to %s"), real && real[0] ? real : addr); filter_rule_set_name (rule, namestr); g_free (namestr); @@ -88,9 +88,9 @@ static const char * strip_re (const char *subject) { const unsigned char *s, *p; - + s = (unsigned char *) subject; - + while (*s) { while (isspace (*s)) s++; @@ -108,7 +108,7 @@ strip_re (const char *subject) } else break; } - + return (char *) s; } @@ -135,7 +135,7 @@ rule_add_subject (RuleContext *context, FilterRule *rule, const char *text) { FilterPart *part; FilterElement *element; - + /* dont match on empty strings ever */ if (*text == 0) return; @@ -152,7 +152,7 @@ rule_add_sender (RuleContext *context, FilterRule *rule, const char *text) { FilterPart *part; FilterElement *element; - + /* dont match on empty strings ever */ if (*text == 0) return; @@ -172,12 +172,12 @@ rule_match_subject (RuleContext *context, FilterRule *rule, const char *subject) const char *s; const char *s1, *s2; char *tmp; - + s = strip_re (subject); /* dont match on empty subject */ if (*s == 0) return; - + /* [blahblah] is probably a mailing list, match on it separately */ s1 = strchr (s, '['); s2 = strchr (s, ']'); @@ -200,7 +200,7 @@ rule_match_subject (RuleContext *context, FilterRule *rule, const char *subject) rule_add_subject (context, rule, tmp); s = s1+1; } - + /* just lump the rest together */ tmp = g_alloca (strlen (s) + 1); strcpy (tmp, s); @@ -213,16 +213,16 @@ rule_match_mlist(RuleContext *context, FilterRule *rule, const char *mlist) { FilterPart *part; FilterElement *element; - + if (mlist[0] == 0) return; - + part = rule_context_create_part(context, "mlist"); filter_rule_add_part(rule, part); - + element = filter_part_find_element(part, "mlist-type"); filter_option_set_current((FilterOption *)element, "is"); - + element = filter_part_find_element (part, "mlist"); filter_input_set_value((FilterInput *)element, mlist); } @@ -235,7 +235,7 @@ rule_from_address (FilterRule *rule, RuleContext *context, CamelInternetAddress* if (flags & AUTO_FROM) { const char *name, *address; char *namestr; - + camel_internet_address_get (addr, 0, &name, &address); rule_add_sender (context, rule, address); if (name == NULL || name[0] == '\0') @@ -254,15 +254,15 @@ static void rule_from_message (FilterRule *rule, RuleContext *context, CamelMimeMessage *msg, int flags) { CamelInternetAddress *addr; - + rule->grouping = FILTER_GROUP_ANY; - + if (flags & AUTO_SUBJECT) { const char *subject = msg->subject ? msg->subject : ""; char *namestr; - + rule_match_subject (context, rule, subject); - + namestr = g_strdup_printf (_("Subject is %s"), strip_re (subject)); filter_rule_set_name (rule, namestr); g_free (namestr); @@ -273,7 +273,7 @@ rule_from_message (FilterRule *rule, RuleContext *context, CamelMimeMessage *msg int i; const char *name, *address; char *namestr; - + from = camel_mime_message_get_from (msg); for (i = 0; from && camel_internet_address_get (from, i, &name, &address); i++) { rule_add_sender(context, rule, address); @@ -294,7 +294,7 @@ rule_from_message (FilterRule *rule, RuleContext *context, CamelMimeMessage *msg } if (flags & AUTO_MLIST) { char *name, *mlist; - + mlist = camel_header_raw_check_mailing_list (&((CamelMimePart *)msg)->headers); if (mlist) { rule_match_mlist(context, rule, mlist); @@ -339,13 +339,13 @@ filter_rule_from_message (EMFilterContext *context, CamelMimeMessage *msg, int f { EMFilterRule *rule; FilterPart *part; - + rule = em_filter_rule_new (); rule_from_message ((FilterRule *)rule, (RuleContext *)context, msg, flags); - + part = em_filter_context_next_action (context, NULL); em_filter_rule_add_action (rule, filter_part_clone (part)); - + return (FilterRule *)rule; } @@ -355,9 +355,9 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag EMFilterContext *fc; char *user, *system; FilterRule *rule; - + g_return_if_fail (msg != NULL); - + fc = em_filter_context_new (); user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ())); @@ -366,9 +366,9 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag g_free (system); rule = filter_rule_from_message (fc, msg, flags); - + filter_rule_set_source (rule, source); - + rule_context_add_rule_gui ((RuleContext *)fc, rule, _("Add Filter Rule"), user); g_free (user); g_object_unref (fc); @@ -390,7 +390,7 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); rule_context_load ((RuleContext *)fc, system, user); g_free (system); - + changed = rule_context_rename_uri((RuleContext *)fc, eolduri, enewuri, g_str_equal); if (changed) { d(printf("Folder rename '%s' -> '%s' changed filters, resaving\n", olduri, newuri)); @@ -398,7 +398,7 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri g_warning("Could not write out changed filter rules\n"); rule_context_free_uri_list((RuleContext *)fc, changed); } - + g_free(user); g_object_unref(fc); @@ -421,13 +421,13 @@ mail_filter_delete_uri(CamelStore *store, const char *uri) system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); rule_context_load ((RuleContext *)fc, system, user); g_free (system); - + deleted = rule_context_delete_uri ((RuleContext *) fc, euri, g_str_equal); if (deleted) { GtkWidget *dialog; GString *s; GList *l; - + s = g_string_new(""); l = deleted; while (l) { @@ -439,13 +439,13 @@ mail_filter_delete_uri(CamelStore *store, const char *uri) g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); g_string_free(s, TRUE); gtk_widget_show(dialog); - + d(printf("Folder delete/rename '%s' changed filters, resaving\n", euri)); if (rule_context_save ((RuleContext *) fc, user) == -1) g_warning ("Could not write out changed filter rules\n"); rule_context_free_uri_list ((RuleContext *) fc, deleted); } - + g_free(user); g_object_unref(fc); g_free(euri); diff --git a/mail/mail-component-factory.c b/mail/mail-component-factory.c index 9c38cfd473..31373e56da 100644 --- a/mail/mail-component-factory.c +++ b/mail/mail-component-factory.c @@ -100,12 +100,12 @@ make_factory (PortableServer_POA poa, const char *iid, gpointer impl_ptr, CORBA_ e_plugin_hook_register_type(em_popup_hook_get_type()); e_plugin_hook_register_type(em_menu_hook_get_type()); e_plugin_hook_register_type(em_config_hook_get_type()); - + em_format_hook_register_type(em_format_get_type()); em_format_hook_register_type(em_format_html_get_type()); em_format_hook_register_type(em_format_html_display_get_type()); em_junk_hook_register_type(emj_get_type()); - + e_plugin_hook_register_type(em_format_hook_get_type()); e_plugin_hook_register_type(em_event_hook_get_type()); e_plugin_hook_register_type(em_junk_hook_get_type()); diff --git a/mail/mail-component.c b/mail/mail-component.c index 9237a1793d..9c2fd80524 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -88,7 +88,7 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-widget.h> -#define d(x) +#define d(x) static void create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_name, void *data); static void view_changed_timeout_remove (EComponentView *component_view); @@ -101,7 +101,7 @@ static BonoboObjectClass *parent_class = NULL; #define OFFLINE 0 #define ONLINE 1 -struct _store_info { +struct _store_info { CamelStore *store; char *name; @@ -126,18 +126,18 @@ struct _MailComponentPrivate { int quit_expunge; /* expunge on quit this time around? */ char *base_directory; - + EMFolderTreeModel *model; EActivityHandler *activity_handler; - + MailAsyncEvent *async_event; GHashTable *store_hash; /* stores store_info objects by store */ - + RuleContext *search_context; - + char *context_path; /* current path for right-click menu */ - + CamelStore *local_store; EComponentView *component_view; @@ -227,7 +227,7 @@ static void mc_add_store(MailComponent *component, CamelStore *store, const char *name, void (*done)(CamelStore *store, CamelFolderInfo *info, void *data)) { struct _store_info *si; - + MAIL_COMPONENT_DEFAULT(component); si = store_info_new(store, name); @@ -320,13 +320,13 @@ load_accounts (MailComponent *component, EAccountList *accounts) * see if this belongs in the shell's folder list. If so, add * it. */ - + iter = e_list_get_iterator ((EList *) accounts); while (e_iterator_is_valid (iter)) { EAccountService *service; EAccount *account; const char *name; - + account = (EAccount *) e_iterator_get (iter); service = account->source; name = account->name; @@ -338,10 +338,10 @@ load_accounts (MailComponent *component, EAccountList *accounts) && service->url[0] && strncmp(service->url, "mbox:", 5) != 0) mail_component_load_store_by_uri (component, service->url, name); - + e_iterator_next (iter); } - + g_object_unref (iter); } @@ -353,7 +353,7 @@ setup_search_context (MailComponent *component) if (priv->search_context == NULL) { char *user = g_build_filename(component->priv->base_directory, "mail/searches.xml", NULL); char *system = g_build_filename (EVOLUTION_PRIVDATADIR, "searchtypes.xml", NULL); - + priv->search_context = (RuleContext *)em_search_context_new (); g_object_set_data_full (G_OBJECT (priv->search_context), "user", user, g_free); g_object_set_data_full (G_OBJECT (priv->search_context), "system", system, g_free); @@ -379,14 +379,14 @@ static void folder_selected_cb (EMFolderTree *emft, const char *path, const char *uri, guint32 flags, EMFolderView *view) { EMFolderTreeModel *model; - + if ((flags & CAMEL_FOLDER_NOSELECT) || !path) { em_folder_view_set_folder (view, NULL, NULL); } else { model = em_folder_tree_get_model (emft); em_folder_tree_model_set_selected (model, uri); em_folder_tree_model_save_state (model); - + em_folder_view_set_folder_uri (view, uri); } } @@ -407,17 +407,17 @@ view_control_activate_cb (BonoboControl *control, gboolean activate, EMFolderVie uic = bonobo_control_get_ui_component (control); g_return_if_fail (uic != NULL); - + if (activate) { Bonobo_UIContainer container; - + container = bonobo_control_get_remote_ui_container (control, NULL); bonobo_ui_component_set_container (uic, container, NULL); bonobo_object_release_unref (container, NULL); - + g_return_if_fail (container == bonobo_ui_component_get_container(uic)); g_return_if_fail (container != CORBA_OBJECT_NIL); - + em_folder_view_activate (view, uic, activate); e_user_creatable_items_handler_activate(g_object_get_data((GObject *)view, "e-creatable-items-handler"), uic); } else { @@ -452,7 +452,7 @@ impl_dispose (GObject *object) g_object_unref (priv->search_context); priv->search_context = NULL; } - + if (priv->local_store != NULL) { camel_object_unref (priv->local_store); priv->local_store = NULL; @@ -469,20 +469,20 @@ impl_finalize (GObject *object) MailComponentPrivate *priv = MAIL_COMPONENT (object)->priv; g_free (priv->base_directory); - + mail_async_event_destroy (priv->async_event); - + g_hash_table_destroy (priv->store_hash); - + if (mail_async_event_destroy (priv->async_event) == -1) { g_warning("Cannot destroy async event: would deadlock"); g_warning(" system may be unstable at exit"); } - + g_free (priv->context_path); g_mutex_free(priv->lock); g_free (priv); - + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -490,7 +490,7 @@ static void view_on_url (GObject *emitter, const char *url, const char *nice_url, MailComponent *mail_component) { MailComponentPrivate *priv = mail_component->priv; - + e_activity_handler_set_message (priv->activity_handler, nice_url); } @@ -576,7 +576,7 @@ view_changed_timeout_remove (EComponentView *component_view) if (v) { g_source_remove(GPOINTER_TO_INT(v)); g_object_set_data((GObject *)component_view, "view-changed-timeout", NULL); - + el = g_object_get_data((GObject *)component_view, "info-label"); emfv = g_object_get_data((GObject *)el, "folderview"); g_object_unref(el); @@ -587,7 +587,7 @@ view_changed_timeout_remove (EComponentView *component_view) static int view_changed_timeout(void *d) { - EComponentView *component_view = d; + EComponentView *component_view = d; EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label"); EMFolderView *emfv = g_object_get_data((GObject *)el, "folderview"); @@ -609,17 +609,17 @@ view_changed_cb(EMFolderView *emfv, EComponentView *component_view) EInfoLabel *el = g_object_get_data((GObject *)component_view, "info-label"); v = g_object_get_data((GObject *)component_view, "view-changed-timeout"); - + if (mc->priv->quit_state != -1) { if (v) { - g_source_remove(GPOINTER_TO_INT(v)); + g_source_remove(GPOINTER_TO_INT(v)); g_object_set_data((GObject *)component_view, "view-changed-timeout", NULL); g_object_unref (emfv); g_object_unref (el); } return; - + } /* This can get called 3 times every cursor move, so we don't need to/want to run it immediately */ @@ -635,13 +635,13 @@ view_changed_cb(EMFolderView *emfv, EComponentView *component_view) g_object_set_data((GObject *)component_view, "view-changed-timeout", GINT_TO_POINTER(g_timeout_add(250, view_changed_timeout, component_view))); } -static void +static void disable_folder_tree (gpointer *emfb, GtkWidget *widget) { gtk_widget_set_sensitive (widget, FALSE); } -static void +static void enable_folder_tree (GtkWidget *emfb, GtkWidget *emft) { EMFolderView *emfv = (EMFolderView *) emfb; @@ -688,16 +688,16 @@ impl_createView (PortableServer_Servant servant, GtkWidget *view_widget; GtkWidget *statusbar_widget; char *uri; - + mail_session_set_interactive(TRUE); mc_startup(mail_component); view_widget = em_folder_browser_new (); - + tree_widget = (GtkWidget *) em_folder_tree_new_with_model (priv->model); em_folder_tree_set_excluded ((EMFolderTree *) tree_widget, 0); em_folder_tree_enable_drag_and_drop ((EMFolderTree *) tree_widget); - + if ((uri = em_folder_tree_model_get_selected (priv->model))) { gboolean expanded; @@ -710,12 +710,12 @@ impl_createView (PortableServer_Servant servant, g_free (uri); } - + em_format_set_session ((EMFormat *) ((EMFolderView *) view_widget)->preview, session); - + g_signal_connect (view_widget, "on-url", G_CALLBACK (view_on_url), mail_component); em_folder_view_set_statusbar ((EMFolderView*)view_widget, FALSE); - + statusbar_widget = e_task_bar_new (); e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget)); @@ -748,7 +748,7 @@ impl_createView (PortableServer_Servant servant, g_signal_connect(((EMFolderBrowser *)view_widget), "account_search_activated", G_CALLBACK (disable_folder_tree), tree_widget); g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), component_view); g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), component_view); - + g_object_set_data((GObject*)info, "folderview", view_widget); g_object_set_data((GObject*)view_widget, "foldertree", tree_widget); @@ -766,7 +766,7 @@ impl_requestQuit(PortableServer_Servant servant, CORBA_Environment *ev) if (!e_msg_composer_request_close_all()) return FALSE; - + folder = mc_default_folders[MAIL_COMPONENT_FOLDER_OUTBOX].folder; if (folder != NULL && camel_session_is_online(session) @@ -802,7 +802,7 @@ mc_quit_delete (CamelStore *store, struct _store_info *si, MailComponent *mc) GPtrArray *uids; int i; - uids = camel_folder_get_uids (folder); + uids = camel_folder_get_uids (folder); camel_folder_freeze(folder); for (i=0;i<uids->len;i++) camel_folder_set_message_flags(folder, uids->pdata[i], CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN); @@ -818,13 +818,13 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev) if (mc->priv->quit_state == -1) mc->priv->quit_state = MC_QUIT_START; - + mail_config_prune_proxies (); switch (mc->priv->quit_state) { case MC_QUIT_START: { int now = time(NULL)/60/60/24, days; gboolean empty_junk; - + GConfClient *gconf = mail_config_get_gconf_client(); mail_vfolder_shutdown(); @@ -841,7 +841,7 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev) g_hash_table_foreach(mc->priv->store_hash, (GHFunc)mc_quit_delete, mc); gconf_client_set_int(gconf, "/apps/evolution/mail/junk/empty_date", now, NULL); } - + g_hash_table_foreach(mc->priv->store_hash, (GHFunc)mc_quit_sync, mc); if (mc->priv->quit_expunge) @@ -902,7 +902,7 @@ create_item(const char *type, EMFolderTreeModel *model, const char *uri, gpointe if (strcmp(type, "message") == 0) { if (!em_utils_check_user_can_send_mail(NULL)) return 0; - + em_utils_compose_new_message(uri); } else if (strcmp(type, "folder") == 0) { em_folder_utils_create_folder(NULL, tree); @@ -917,7 +917,7 @@ create_local_item_cb(EUserCreatableItemsHandler *handler, const char *item_type_ { EMFolderTree *tree = data; char *uri = em_folder_tree_get_selected_uri(tree); - + create_item(item_type_name, em_folder_tree_get_model(tree), uri, (gpointer) tree); g_free(uri); } @@ -961,13 +961,13 @@ handleuri_got_folder(char *uri, CamelFolder *folder, void *data) const char* uid; uid = camel_url_get_param(url, "uid"); - if (uid == NULL) + if (uid == NULL) g_warning("Could not forward the message. UID is NULL."); else { uids = g_ptr_array_new(); g_ptr_array_add(uids, g_strdup(uid)); - if (!strcmp(forward, "attached")) + if (!strcmp(forward, "attached")) em_utils_forward_attached(folder, uids, uri); else if (!strcmp(forward, "inline")) em_utils_forward_inline(folder, uids, uri); @@ -1029,7 +1029,7 @@ impl_upgradeFromVersion (PortableServer_Servant servant, const short major, cons CamelException ex; component = mail_component_peek (); - + camel_exception_init (&ex); if (em_migrate (component->priv->base_directory, major, minor, revision, &ex) == -1) { GNOME_Evolution_Component_UpgradeFailed *failedex; @@ -1083,7 +1083,7 @@ setline_check(void *key, void *value, void *data) } } -int +int status_check (GNOME_Evolution_ShellState shell_state) { int status = 0; @@ -1094,7 +1094,7 @@ status_check (GNOME_Evolution_ShellState shell_state) status = OFFLINE; if (em_utils_prompt_user (NULL, "/apps/evolution/mail/prompts/quick_offline", "mail:ask-quick-offline", NULL)) break; - case GNOME_Evolution_FORCED_OFFLINE: + case GNOME_Evolution_FORCED_OFFLINE: /*Network is down so change network state on the camel session*/ status = OFFLINE; /* Cancel all operations as they wont happen anyway cos Network is down*/ @@ -1104,7 +1104,7 @@ status_check (GNOME_Evolution_ShellState shell_state) case GNOME_Evolution_USER_ONLINE: camel_session_set_network_state (session, TRUE); status = ONLINE; - } + } return status; } @@ -1156,12 +1156,12 @@ mail_component_class_init (MailComponentClass *class) POA_GNOME_Evolution_Component__epv *epv = &((EvolutionComponentClass *)class)->epv; POA_GNOME_Evolution_MailComponent__epv *mepv = &class->epv; GObjectClass *object_class = G_OBJECT_CLASS (class); - + parent_class = g_type_class_peek_parent (class); - + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; - + epv->createView = impl_createView; epv->requestQuit = impl_requestQuit; epv->quit = impl_quit; @@ -1186,10 +1186,10 @@ static void mail_component_init (MailComponent *component) { MailComponentPrivate *priv; - + priv = g_new0 (MailComponentPrivate, 1); component->priv = priv; - + priv->lock = g_mutex_new(); priv->quit_state = -1; @@ -1203,19 +1203,19 @@ mail_component_init (MailComponent *component) #endif if (g_mkdir_with_parents (priv->base_directory, 0777) == -1 && errno != EEXIST) abort (); - + priv->model = em_folder_tree_model_new (priv->base_directory); - + priv->activity_handler = e_activity_handler_new (); - + mail_session_init (priv->base_directory); - + priv->async_event = mail_async_event_new(); priv->store_hash = g_hash_table_new_full ( NULL, NULL, (GDestroyNotify) NULL, (GDestroyNotify) store_hash_free); - + mail_autoreceive_init(); } @@ -1275,7 +1275,7 @@ mail_component_add_store (MailComponent *component, CamelStore *store, const cha * @component: mail component * @uri: uri of store * @name: name of store (used for display purposes) - * + * * Return value: Pointer to the newly added CamelStore. The caller is supposed * to ref the object if it wants to store it. **/ @@ -1287,14 +1287,14 @@ mail_component_load_store_by_uri (MailComponent *component, const char *uri, con CamelProvider *prov; MAIL_COMPONENT_DEFAULT(component); - + camel_exception_init (&ex); - + /* Load the service (don't connect!). Check its provider and * see if this belongs in the shell's folder list. If so, add * it. */ - + prov = camel_provider_get(uri, &ex); if (prov == NULL) { /* EPFIXME: real error dialog */ @@ -1303,10 +1303,10 @@ mail_component_load_store_by_uri (MailComponent *component, const char *uri, con camel_exception_clear (&ex); return NULL; } - + if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE)) return NULL; - + store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex); if (store == NULL) { /* EPFIXME: real error dialog */ @@ -1318,7 +1318,7 @@ mail_component_load_store_by_uri (MailComponent *component, const char *uri, con mail_component_add_store(component, store, name); camel_object_unref (store); - + return store; } @@ -1343,19 +1343,19 @@ mail_component_remove_store (MailComponent *component, CamelStore *store) * any call to camel_session_get_{service,store} with the same * URL will always return the same object. So this works. */ - + if (g_hash_table_lookup (priv->store_hash, store) == NULL) return; - + camel_object_ref (store); g_hash_table_remove (priv->store_hash, store); - + /* so i guess potentially we could have a race, add a store while one being removed. ?? */ mail_note_store_remove (store); - + em_folder_tree_model_remove_store (priv->model, store); - + mail_async_event_emit (priv->async_event, MAIL_ASYNC_THREAD, (MailAsyncFunc) store_disconnect, store, NULL, NULL); } @@ -1366,13 +1366,13 @@ mail_component_remove_store_by_uri (MailComponent *component, const char *uri) CamelStore *store; MAIL_COMPONENT_DEFAULT(component); - + if (!(prov = camel_provider_get(uri, NULL))) return; - + if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE)) return; - + store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL); if (store != NULL) { mail_component_remove_store (component, store); @@ -1431,18 +1431,18 @@ mail_component_peek_local_store (MailComponent *mc) { MAIL_COMPONENT_DEFAULT (mc); mc_setup_local_store (mc); - + return mc->priv->local_store; } /** * mail_component_get_folder: - * @mc: - * @id: - * + * @mc: + * @id: + * * Get a standard/default folder by id. This call is thread-safe. - * - * Return value: + * + * Return value: **/ struct _CamelFolder * mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id) @@ -1457,12 +1457,12 @@ mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id) /** * mail_component_get_folder_uri: - * @mc: - * @id: - * + * @mc: + * @id: + * * Get a standard/default folder's uri. This call is thread-safe. - * - * Return value: + * + * Return value: **/ const char * mail_component_get_folder_uri(MailComponent *mc, enum _mail_component_folder_t id) diff --git a/mail/mail-component.h b/mail/mail-component.h index 901e612a21..e5c5a29e6f 100644 --- a/mail/mail-component.h +++ b/mail/mail-component.h @@ -52,13 +52,13 @@ enum _mail_component_folder_t { struct _MailComponent { EvolutionComponent parent; - + MailComponentPrivate *priv; }; struct _MailComponentClass { EvolutionComponentClass parent_class; - + POA_GNOME_Evolution_MailComponent__epv epv; }; diff --git a/mail/mail-config-factory.c b/mail/mail-config-factory.c index abd63021f1..27ed15e0d9 100644 --- a/mail/mail-config-factory.c +++ b/mail/mail-config-factory.c @@ -41,7 +41,7 @@ mail_config_control_factory_cb (BonoboGenericFactory *factory, const char *compo GNOME_Evolution_Shell shell = (GNOME_Evolution_Shell) user_data; EvolutionConfigControl *control; GtkWidget *prefs = NULL; - + if (!strcmp (component_id, EM_ACCOUNT_PREFS_CONTROL_ID)) { prefs = em_account_prefs_new (shell); } else if (!strcmp (component_id, EM_MAILER_PREFS_CONTROL_ID)) { @@ -51,10 +51,10 @@ mail_config_control_factory_cb (BonoboGenericFactory *factory, const char *compo } else { g_return_val_if_reached(NULL); } - + gtk_widget_show_all (prefs); - + control = evolution_config_control_new (prefs); - + return BONOBO_OBJECT (control); } diff --git a/mail/mail-config.c b/mail/mail-config.c index ef16f521a6..eda95c7982 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -87,31 +87,31 @@ MailConfigLabel label_defaults[5] = { typedef struct { GConfClient *gconf; - + gboolean corrupt; - + char *gtkrc; - + EAccountList *accounts; ESignatureList *signatures; - + GSList *labels; guint label_notify_id; - + guint font_notify_id; guint spell_notify_id; guint mark_citations__notify_id; guint citation_colour_notify_id; guint address_count_notify_id; - guint address_compress_notify_id; - gboolean address_compress; + guint address_compress_notify_id; + gboolean address_compress; gint address_count; guint mlimit_size_notify_id; - guint mlimit_notify_id; - gboolean mlimit; + guint mlimit_notify_id; + gboolean mlimit; gint mlimit_size; - - + + GPtrArray *mime_types; guint mime_types_notify_id; } MailConfig; @@ -138,7 +138,7 @@ config_clear_labels (void) { MailConfigLabel *label; GSList *list, *n; - + list = config->labels; while (list != NULL) { label = list->data; @@ -146,12 +146,12 @@ config_clear_labels (void) g_free (label->name); g_free (label->colour); g_free (label); - + n = list->next; g_slist_free_1 (list); list = n; } - + config->labels = NULL; } @@ -162,70 +162,70 @@ config_cache_labels (void) MailConfigLabel *label; char *buf, *colour; int num = 0; - + tail = labels = NULL; - + list = gconf_client_get_list (config->gconf, "/apps/evolution/mail/labels", GCONF_VALUE_STRING, NULL); - + while (list != NULL) { buf = list->data; - + if (num < 5 && (colour = strrchr (buf, ':'))) { label = g_new (MailConfigLabel, 1); - + *colour++ = '\0'; label->tag = g_strdup(label_defaults[num].tag); - /* Don't translate an empty string */ + /* Don't translate an empty string */ if (buf == NULL || buf[0] == '\0') label->name = g_strdup (_("Unnamed")); else label->name = g_strdup (_(buf)); label->colour = g_strdup (colour); - + n = g_slist_alloc (); n->next = NULL; n->data = label; - + if (tail == NULL) labels = n; else tail->next = n; - + tail = n; - + num++; } - + g_free (buf); - + n = list->next; g_slist_free_1 (list); list = n; } - + while (num < 5) { /* complete the list with defaults */ label = g_new (MailConfigLabel, 1); label->tag = g_strdup (label_defaults[num].tag); label->name = g_strdup (_(label_defaults[num].name)); label->colour = g_strdup (label_defaults[num].colour); - + n = g_slist_alloc (); n->next = NULL; n->data = label; - + if (tail == NULL) labels = n; else tail->next = n; - + tail = n; - + num++; } - + config->labels = labels; } @@ -233,10 +233,10 @@ static void config_clear_mime_types (void) { int i; - + for (i = 0; i < config->mime_types->len; i++) g_free (config->mime_types->pdata[i]); - + g_ptr_array_set_size (config->mime_types, 0); } @@ -244,7 +244,7 @@ static void config_cache_mime_types (void) { GSList *n, *nn; - + n = gconf_client_get_list (config->gconf, "/apps/evolution/mail/display/mime_types", GCONF_VALUE_STRING, NULL); while (n != NULL) { nn = n->next; @@ -252,7 +252,7 @@ config_cache_mime_types (void) g_slist_free_1 (n); n = nn; } - + g_ptr_array_add (config->mime_types, NULL); } @@ -271,12 +271,12 @@ config_write_style (void) char *var_font; char *citation_color; FILE *rc; - + if (!(rc = g_fopen (config->gtkrc, "wt"))) { g_warning ("unable to open %s", config->gtkrc); return; } - + custom = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/fonts/use_custom", NULL); var_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/variable", NULL); fix_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL); @@ -298,13 +298,13 @@ config_write_style (void) fprintf (rc, " GtkHTML::fixed_font_name = \"%s\"\n" " font_name = \"%s\"\n", - fix_font, var_font); + fix_font, var_font); } g_free (fix_font); g_free (var_font); fprintf (rc, "}\n\n"); - + fprintf (rc, "widget \"*.EMFolderView.*.GtkHTML\" style \"evolution-mail-custom-fonts\"\n"); fprintf (rc, "widget \"*.EMFolderBrowser.*.GtkHTML\" style \"evolution-mail-custom-fonts\"\n"); fprintf (rc, "widget \"*.EMMessageBrowser.*.GtkHTML\" style \"evolution-mail-custom-fonts\"\n"); @@ -312,7 +312,7 @@ config_write_style (void) fprintf (rc, "widget \"*.EvolutionMailPrintHTMLWidget\" style \"evolution-mail-custom-fonts\"\n"); fflush (rc); fclose (rc); - + gtk_rc_reparse_all (); } @@ -373,16 +373,16 @@ mail_config_init (void) { if (config) return; - + config = g_new0 (MailConfig, 1); config->gconf = gconf_client_get_default (); config->mime_types = g_ptr_array_new (); config->gtkrc = g_build_filename (g_get_home_dir (), ".evolution", "mail", "config", "gtkrc-mail-fonts", NULL); - + mail_config_clear (); - + gtk_rc_parse (config->gtkrc); - + gconf_client_add_dir (config->gconf, "/apps/evolution/mail/display", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_add_dir (config->gconf, "/apps/evolution/mail/display/fonts", @@ -392,32 +392,32 @@ mail_config_init (void) config->font_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/fonts", gconf_style_changed, NULL, NULL, NULL); config->font_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/address_compress", - gconf_address_compress_changed, NULL, NULL, NULL); + gconf_address_compress_changed, NULL, NULL, NULL); config->font_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/address_count", gconf_address_count_changed, NULL, NULL, NULL); config->mlimit_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/force_message_limit", - gconf_mlimit_changed, NULL, NULL, NULL); + gconf_mlimit_changed, NULL, NULL, NULL); config->mlimit_size_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/message_text_part_limit", - gconf_mlimit_size_changed, NULL, NULL, NULL); + gconf_mlimit_size_changed, NULL, NULL, NULL); config->spell_notify_id = gconf_client_notify_add (config->gconf, "/GNOME/Spell", gconf_style_changed, NULL, NULL, NULL); config->mark_citations__notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/mark_citations", gconf_style_changed, NULL, NULL, NULL); config->citation_colour_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/citation_colour", gconf_style_changed, NULL, NULL, NULL); - + gconf_client_add_dir (config->gconf, "/apps/evolution/mail/labels", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); config->label_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/labels", gconf_labels_changed, NULL, NULL, NULL); - + gconf_client_add_dir (config->gconf, "/apps/evolution/mail/mime_types", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); config->mime_types_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/mime_types", gconf_mime_types_changed, NULL, NULL, NULL); - + config_cache_labels (); config_cache_mime_types (); config->address_compress = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/address_compress", NULL); @@ -434,17 +434,17 @@ mail_config_clear (void) { if (!config) return; - + if (config->accounts) { g_object_unref (config->accounts); config->accounts = NULL; } - + if (config->signatures) { g_object_unref (config->signatures); config->signatures = NULL; } - + config_clear_labels (); config_clear_mime_types (); } @@ -455,10 +455,10 @@ mail_config_write (void) { if (!config) return; - + e_account_list_save (config->accounts); e_signature_list_save (config->signatures); - + gconf_client_suggest_sync (config->gconf, NULL); } @@ -467,67 +467,67 @@ mail_config_write_on_exit (void) { EAccount *account; EIterator *iter; - + if (config_write_timeout) { g_source_remove (config_write_timeout); config_write_timeout = 0; mail_config_write (); } - + /* Passwords */ - + /* then we make sure the ones we want to remember are in the session cache */ iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { char *passwd; - + account = (EAccount *) e_iterator_get (iter); - + if (account->source->save_passwd && account->source->url && account->source->url[0]) { passwd = mail_session_get_password (account->source->url); mail_session_forget_password (account->source->url); mail_session_add_password (account->source->url, passwd); g_free (passwd); } - + if (account->transport->save_passwd && account->transport->url && account->transport->url[0]) { passwd = mail_session_get_password (account->transport->url); mail_session_forget_password (account->transport->url); mail_session_add_password (account->transport->url, passwd); g_free (passwd); } - + e_iterator_next (iter); } - + g_object_unref (iter); - + /* then we clear out our component passwords */ e_passwords_clear_passwords ("Mail"); - + /* then we remember them */ iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->source->save_passwd && account->source->url && account->source->url[0]) mail_session_remember_password (account->source->url); - + if (account->transport->save_passwd && account->transport->url && account->transport->url[0]) mail_session_remember_password (account->transport->url); - + e_iterator_next (iter); } - + /* now do cleanup */ mail_config_clear (); - + g_object_unref (config->gconf); g_ptr_array_free (config->mime_types, TRUE); - + g_free (config->gtkrc); - + g_free (config); } @@ -558,7 +558,7 @@ mail_config_get_labels (void) int mail_config_get_address_count (void) -{ +{ if (!config->address_compress) return -1; @@ -571,7 +571,7 @@ mail_config_get_message_limit (void) if (!config->mlimit) return -1; - return config->mlimit_size; + return config->mlimit_size; } const char * @@ -579,7 +579,7 @@ mail_config_get_label_color_by_name (const char *name) { MailConfigLabel *label; GSList *node; - + node = config->labels; while (node != NULL) { label = node->data; @@ -587,7 +587,7 @@ mail_config_get_label_color_by_name (const char *name) return label->colour; node = node->next; } - + return NULL; } @@ -595,12 +595,12 @@ const char * mail_config_get_label_color_by_index (int index) { MailConfigLabel *label; - + label = g_slist_nth_data (config->labels, index); - + if (label) return label->colour; - + return NULL; } @@ -615,7 +615,7 @@ mail_config_find_account (EAccount *account) { EAccount *acnt; EIterator *iter; - + iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { acnt = (EAccount *) e_iterator_get (iter); @@ -623,12 +623,12 @@ mail_config_find_account (EAccount *account) g_object_unref (iter); return TRUE; } - + e_iterator_next (iter); } - + g_object_unref (iter); - + return FALSE; } @@ -637,7 +637,7 @@ mail_config_get_default_account (void) { if (config == NULL) mail_config_init (); - + if (!config->accounts) return NULL; @@ -664,44 +664,44 @@ mail_config_get_account_by_source_url (const char *source_url) EAccount *account; CamelURL *source; EIterator *iter; - + g_return_val_if_fail (source_url != NULL, NULL); - + provider = camel_provider_get(source_url, NULL); if (!provider) return NULL; - + source = camel_url_new (source_url, NULL); if (!source) return NULL; - + iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->source && account->source->url && account->source->url[0]) { CamelURL *url; - + url = camel_url_new (account->source->url, NULL); if (url && provider->url_equal (url, source)) { camel_url_free (url); camel_url_free (source); g_object_unref (iter); - + return account; } - + if (url) camel_url_free (url); } - + e_iterator_next (iter); } - + g_object_unref (iter); - + camel_url_free (source); - + return NULL; } @@ -712,44 +712,44 @@ mail_config_get_account_by_transport_url (const char *transport_url) CamelURL *transport; EAccount *account; EIterator *iter; - + g_return_val_if_fail (transport_url != NULL, NULL); - + provider = camel_provider_get(transport_url, NULL); if (!provider) return NULL; - + transport = camel_url_new (transport_url, NULL); if (!transport) return NULL; - + iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->transport && account->transport->url && account->transport->url[0]) { CamelURL *url; - + url = camel_url_new (account->transport->url, NULL); if (url && provider->url_equal (url, transport)) { camel_url_free (url); camel_url_free (transport); g_object_unref (iter); - + return account; } - + if (url) camel_url_free (url); } - + e_iterator_next (iter); } - + g_object_unref (iter); - + camel_url_free (transport); - + return NULL; } @@ -775,8 +775,8 @@ EAccountList * mail_config_get_accounts (void) { if (config == NULL) - mail_config_init (); - + mail_config_init (); + return config->accounts; } @@ -804,7 +804,7 @@ EAccountIdentity * mail_config_get_default_identity (void) { EAccount *account; - + account = mail_config_get_default_account (); if (account) return account->id; @@ -817,27 +817,27 @@ mail_config_get_default_transport (void) { EAccount *account; EIterator *iter; - + account = mail_config_get_default_account (); if (account && account->enabled && account->transport && account->transport->url && account->transport->url[0]) return account->transport; - + /* return the first account with a transport? */ iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->enabled && account->transport && account->transport->url && account->transport->url[0]) { g_object_unref (iter); - + return account->transport; } - + e_iterator_next (iter); } - + g_object_unref (iter); - + return NULL; } @@ -847,7 +847,7 @@ uri_to_evname (const char *uri, const char *prefix) const char *base_directory = mail_component_peek_base_directory (mail_component_peek ()); char *safe; char *tmp; - + safe = g_strdup (uri); e_filename_make_safe (safe); /* blah, easiest thing to do */ @@ -866,37 +866,37 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new) EIterator *iter; int i, work = 0; char *oldname, *newname; - char *cachenames[] = { "config/hidestate-", - "config/et-expanded-", - "config/et-header-", + char *cachenames[] = { "config/hidestate-", + "config/et-expanded-", + "config/et-header-", "*views/current_view-", "*views/custom_view-", NULL }; - + iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->sent_folder_uri && uri_cmp (account->sent_folder_uri, old)) { g_free (account->sent_folder_uri); account->sent_folder_uri = g_strdup (new); work = 1; } - + if (account->drafts_folder_uri && uri_cmp (account->drafts_folder_uri, old)) { g_free (account->drafts_folder_uri); account->drafts_folder_uri = g_strdup (new); work = 1; } - + e_iterator_next (iter); } - + g_object_unref (iter); - + /* ignore return values or if the files exist or * not, doesn't matter */ - + for (i = 0; cachenames[i]; i++) { oldname = uri_to_evname (old, cachenames[i]); newname = uri_to_evname (new, cachenames[i]); @@ -905,7 +905,7 @@ mail_config_uri_renamed (GCompareFunc uri_cmp, const char *old, const char *new) g_free (oldname); g_free (newname); } - + /* nasty ... */ if (work) mail_config_write (); @@ -920,32 +920,32 @@ mail_config_uri_deleted (GCompareFunc uri_cmp, const char *uri) /* assumes these can't be removed ... */ const char *default_sent_folder_uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT); const char *default_drafts_folder_uri = mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS); - + iter = e_list_get_iterator ((EList *) config->accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->sent_folder_uri && uri_cmp (account->sent_folder_uri, uri)) { g_free (account->sent_folder_uri); account->sent_folder_uri = g_strdup (default_sent_folder_uri); work = 1; } - + if (account->drafts_folder_uri && uri_cmp (account->drafts_folder_uri, uri)) { g_free (account->drafts_folder_uri); account->drafts_folder_uri = g_strdup (default_drafts_folder_uri); work = 1; } - + e_iterator_next (iter); } - + /* nasty again */ if (work) mail_config_write (); } -void +void mail_config_service_set_save_passwd (EAccountService *service, gboolean save_passwd) { service->save_passwd = save_passwd; @@ -955,10 +955,10 @@ char * mail_config_folder_to_safe_url (CamelFolder *folder) { char *url; - + url = mail_tools_folder_to_url (folder); e_filename_make_safe (url); - + return url; } @@ -967,15 +967,15 @@ mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix) { char *url, *basename, *filename; const char *evolution_dir; - + evolution_dir = mail_component_peek_base_directory (mail_component_peek ()); - + url = mail_config_folder_to_safe_url (folder); basename = g_strdup_printf ("%s%s", prefix, url); filename = g_build_filename (evolution_dir, "mail", "config", basename, NULL); g_free (basename); g_free (url); - + return filename; } @@ -1003,16 +1003,16 @@ get_new_signature_filename (void) g_warning ("Fatal problem with %s directory.", filename); } g_free (filename); - + filename = g_malloc (strlen (base_directory) + sizeof ("/signatures/signature-") + 12); id = g_stpcpy (filename, base_directory); id = g_stpcpy (id, "/signatures/signature-"); - + for (i = 0; i < (INT_MAX - 1); i++) { sprintf (id, "%d", i); if (g_lstat (filename, &st) == -1 && errno == ENOENT) { int fd; - + fd = g_creat (filename, 0600); if (fd >= 0) { close (fd); @@ -1020,9 +1020,9 @@ get_new_signature_filename (void) } } } - + g_free (filename); - + return NULL; } @@ -1031,17 +1031,17 @@ ESignature * mail_config_signature_new (const char *filename, gboolean script, gboolean html) { ESignature *sig; - + sig = e_signature_new (); sig->name = g_strdup (_("Unnamed")); sig->script = script; sig->html = html; - + if (filename == NULL) sig->filename = get_new_signature_filename (); else sig->filename = g_strdup (filename); - + return sig; } @@ -1069,7 +1069,7 @@ mail_config_remove_signature (ESignature *signature) { if (signature->filename && !signature->script) g_unlink (signature->filename); - + e_signature_list_remove (config->signatures, signature); mail_config_save_signatures (); } @@ -1086,24 +1086,24 @@ mail_config_signature_run_script (const char *script) g_warning ("Failed to create pipe to '%s': %s", script, g_strerror (errno)); return NULL; } - + if (!(pid = fork ())) { /* child process */ int maxfd, i; - + close (in_fds [0]); if (dup2 (in_fds[1], STDOUT_FILENO) < 0) _exit (255); close (in_fds [1]); - + setsid (); - + maxfd = sysconf (_SC_OPEN_MAX); for (i = 3; i < maxfd; i++) { if (i != STDIN_FILENO && i != STDOUT_FILENO && i != STDERR_FILENO) fcntl (i, F_SETFD, FD_CLOEXEC); } - + execlp("/bin/sh", "/bin/sh", "-c", script, NULL); g_warning ("Could not execute %s: %s\n", script, g_strerror (errno)); _exit (255); @@ -1120,19 +1120,19 @@ mail_config_signature_run_script (const char *script) GByteArray *buffer; char *charset; char *content; - + /* parent process */ close (in_fds[1]); - + stream = camel_stream_fs_new_with_fd (in_fds[0]); - + memstream = (CamelStreamMem *) camel_stream_mem_new (); buffer = g_byte_array_new (); camel_stream_mem_set_byte_array (memstream, buffer); - + camel_stream_write_to_stream (stream, (CamelStream *) memstream); camel_object_unref (stream); - + /* signature scripts are supposed to generate UTF-8 content, but because users are known to not ever read the manual... we try to do our best if the content isn't valid UTF-8 by assuming that the content is in the user's @@ -1141,10 +1141,10 @@ mail_config_signature_run_script (const char *script) stream = (CamelStream *) memstream; memstream = (CamelStreamMem *) camel_stream_mem_new (); camel_stream_mem_set_byte_array (memstream, g_byte_array_new ()); - + filtered_stream = camel_stream_filter_new_with_stream (stream); camel_object_unref (stream); - + charset = gconf_client_get_string (config->gconf, "/apps/evolution/mail/composer/charset", NULL); if (charset && *charset) { if ((charenc = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "utf-8"))) { @@ -1153,23 +1153,23 @@ mail_config_signature_run_script (const char *script) } } g_free (charset); - + camel_stream_write_to_stream ((CamelStream *) filtered_stream, (CamelStream *) memstream); camel_object_unref (filtered_stream); g_byte_array_free (buffer, TRUE); - + buffer = memstream->buffer; } - + camel_object_unref (memstream); - + g_byte_array_append (buffer, (const unsigned char *)"", 1); content = (char *)buffer->data; g_byte_array_free (buffer, FALSE); - + /* wait for the script process to terminate */ result = waitpid (pid, &status, 0); - + if (result == -1 && errno == EINTR) { /* child process is hanging... */ kill (pid, SIGTERM); @@ -1182,7 +1182,7 @@ mail_config_signature_run_script (const char *script) result = waitpid (pid, &status, WNOHANG); } } - + return content; } #else diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c index a23c9f64b5..324f0c3743 100644 --- a/mail/mail-crypto.c +++ b/mail/mail-crypto.c @@ -44,10 +44,10 @@ CamelCipherContext * mail_crypto_get_pgp_cipher_context (EAccount *account) { CamelCipherContext *cipher; - + cipher = camel_gpg_context_new (session); if (account) camel_gpg_context_set_always_trust ((CamelGpgContext *) cipher, account->pgp_always_trust); - + return cipher; } diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 46e9446566..5433616a1b 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -1,12 +1,12 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * + * * Authors: Peter Williams <peterw@ximian.com> * Michael Zucchi <notzed@ximian.com> * * Copyright 2000,2001 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, @@ -80,9 +80,9 @@ struct _folder_info { char *full_name; /* full name of folder/folderinfo */ char *uri; /* uri of folder */ - + guint32 flags; - + CamelFolder *folder; /* if known */ }; @@ -160,9 +160,9 @@ notify_idle_cb (gpointer user_data) { GConfClient *gconf; char *filename; - + gconf = mail_config_get_gconf_client (); - + switch (notify_type) { case MAIL_CONFIG_NOTIFY_PLAY_SOUND: filename = gconf_client_get_string (gconf, "/apps/evolution/mail/notify/sound", NULL); @@ -177,11 +177,11 @@ notify_idle_cb (gpointer user_data) default: break; } - + time (&last_notify); - + notify_idle_id = 0; - + return FALSE; } @@ -198,10 +198,10 @@ real_flush_updates(void *o, void *event_data, void *data) struct _MailComponent *component; struct _EMFolderTreeModel *model; struct _folder_update *up; - + component = mail_component_peek (); model = mail_component_peek_tree_model (component); - + LOCK(info_lock); while ((up = (struct _folder_update *)e_dlist_remhead(&updates))) { UNLOCK(info_lock); @@ -223,18 +223,18 @@ real_flush_updates(void *o, void *event_data, void *data) mail_config_uri_renamed(CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(up->store))->compare_folder_name, up->olduri, up->uri); } - + if (!up->olduri && up->add) mail_vfolder_add_uri(up->store, up->uri, FALSE); } - + /* update unread counts */ em_folder_tree_model_set_unread_count (model, up->store, up->full_name, up->unread); /* new mail notification */ if (notify_type == -1) { /* need to track the user's new-mail-notification settings... */ GConfClient *gconf; - + gconf = mail_config_get_gconf_client (); gconf_client_add_dir (gconf, "/apps/evolution/mail/notify", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); @@ -242,10 +242,10 @@ real_flush_updates(void *o, void *event_data, void *data) notify_type_changed, NULL, NULL, NULL); notify_type = gconf_client_get_int (gconf, "/apps/evolution/mail/notify/type", NULL); } - + if (notify_type != 0 && up->new && notify_idle_id == 0 && (last_newmail - last_notify >= NOTIFY_THROTTLE)) notify_idle_id = g_idle_add_full (G_PRIORITY_LOW, notify_idle_cb, NULL, NULL); - + if (up->uri) { EMEvent *e = em_event_peek(); EMEventTargetFolder *t = em_event_target_new_folder(e, up->uri, up->new); @@ -258,7 +258,7 @@ real_flush_updates(void *o, void *event_data, void *data) /** @Event: folder.changed * @Title: Folder changed * @Target: EMEventTargetFolder - * + * * folder.changed is emitted whenever a folder changes. There is no detail on how the folder has changed. * UPDATE: We tell the number of new UIDs added rather than the new mails received */ @@ -266,7 +266,7 @@ real_flush_updates(void *o, void *event_data, void *data) } free_update(up); - + LOCK(info_lock); } update_id = -1; @@ -348,7 +348,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) CamelFolder *folder; int unread = -1; int deleted; - + folder = mfi->folder; if (folder) { d(printf("update 1 folder '%s'\n", folder->full_name)); @@ -358,7 +358,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) || (count_sent && folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT))) { d(printf(" total count\n")); unread = camel_folder_get_message_count (folder); - if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX) + if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX) || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) { guint32 junked = 0; @@ -368,7 +368,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) camel_object_get (folder, NULL, CAMEL_FOLDER_JUNKED, &junked, NULL); if (junked > 0) unread -= junked; - + } } else { d(printf(" unread count\n")); @@ -412,7 +412,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) mfi->uri = g_strdup(fi->uri); mfi->store_info = si; mfi->flags = fi->flags; - + g_hash_table_insert(si->folders, mfi->full_name, mfi); g_hash_table_insert(si->folders_uri, mfi->uri, mfi); @@ -422,7 +422,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) up->unread = fi->unread; up->store = si->store; camel_object_ref(up->store); - + if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; @@ -458,7 +458,7 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) int new = 0; int i; guint32 flags; - + d(printf("folder '%s' changed\n", folder->full_name)); if (!CAMEL_IS_VEE_FOLDER(folder) @@ -480,10 +480,10 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) } } } - + if (new > 0) time (&last_newmail); - + LOCK(info_lock); if (stores != NULL && (si = g_hash_table_lookup(stores, store)) != NULL @@ -671,7 +671,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, mfi->full_name = g_strdup(fi->full_name); mfi->uri = g_strdup(fi->uri); mfi->flags = fi->flags; - + g_hash_table_insert(si->folders, mfi->full_name, mfi); g_hash_table_insert(si->folders_uri, mfi->uri, mfi); } else { @@ -682,7 +682,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, mfi->uri = g_strdup(fi->uri); mfi->store_info = si; mfi->flags = fi->flags; - + g_hash_table_insert(si->folders, mfi->full_name, mfi); g_hash_table_insert(si->folders_uri, mfi->uri, mfi); } @@ -692,7 +692,7 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, up->unread = fi->unread==-1?0:fi->unread; up->store = si->store; camel_object_ref(up->store); - + if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) up->add = TRUE; @@ -783,7 +783,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) struct _update_data { struct _update_data *next; struct _update_data *prev; - + int id; /* id for cancellation */ guint cancel:1; /* also tells us we're cancelled */ @@ -835,7 +835,7 @@ mail_note_store_remove(CamelStore *store) ud->cancel = 1; ud = ud->next; } - + camel_object_unref(si->store); g_hash_table_foreach(si->folders, (GHFunc)free_folder_info_hash, NULL); g_hash_table_destroy(si->folders); @@ -874,7 +874,7 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data) struct _ping_store_msg { struct _mail_msg msg; - + CamelStore *store; }; @@ -884,10 +884,10 @@ ping_store_desc (struct _mail_msg *mm, int done) struct _ping_store_msg *m = (struct _ping_store_msg *) mm; char *service_name = camel_service_get_name (CAMEL_SERVICE (m->store), TRUE); char *msg; - + msg = g_strdup_printf (_("Pinging %s"), service_name); g_free (service_name); - + return msg; } @@ -896,12 +896,12 @@ ping_store_ping (struct _mail_msg *mm) { gboolean online = FALSE; struct _ping_store_msg *m = (struct _ping_store_msg *) mm; - + if (CAMEL_SERVICE (m->store)->status == CAMEL_SERVICE_CONNECTED) { if (CAMEL_IS_DISCO_STORE (m->store) && camel_disco_store_status (CAMEL_DISCO_STORE (m->store)) != CAMEL_DISCO_STORE_OFFLINE) online = TRUE; - else if (CAMEL_IS_OFFLINE_STORE (m->store) && + else if (CAMEL_IS_OFFLINE_STORE (m->store) && CAMEL_OFFLINE_STORE (m->store)->state != CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) online = TRUE; } @@ -913,7 +913,7 @@ static void ping_store_free (struct _mail_msg *mm) { struct _ping_store_msg *m = (struct _ping_store_msg *) mm; - + camel_object_unref (m->store); } @@ -929,14 +929,14 @@ ping_store (gpointer key, gpointer val, gpointer user_data) { CamelStore *store = (CamelStore *) key; struct _ping_store_msg *m; - + if (CAMEL_SERVICE (store)->status != CAMEL_SERVICE_CONNECTED) return; - + m = mail_msg_new (&ping_store_op, NULL, sizeof (struct _ping_store_msg)); m->store = store; camel_object_ref (store); - + e_thread_put (mail_thread_queued_slow, (EMsg *) m); } @@ -944,11 +944,11 @@ static gboolean ping_cb (gpointer user_data) { LOCK (info_lock); - + g_hash_table_foreach (stores, ping_store, NULL); - + UNLOCK (info_lock); - + return TRUE; } @@ -980,7 +980,7 @@ mail_note_store(CamelStore *store, CamelOperation *op, const char *buf; guint timeout; int hook = 0; - + g_return_if_fail (CAMEL_IS_STORE(store)); g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread)); @@ -1009,12 +1009,12 @@ mail_note_store(CamelStore *store, CamelOperation *op, e_dlist_init(&si->folderinfo_updates); hook = TRUE; } - + ud = g_malloc(sizeof(*ud)); ud->done = done; ud->data = data; ud->cancel = 0; - + /* We might get a race when setting up a store, such that it is still left in offline mode, after we've gone online. This catches and fixes it up when the shell opens us */ if (CAMEL_IS_DISCO_STORE (store)) { @@ -1036,9 +1036,9 @@ mail_note_store(CamelStore *store, CamelOperation *op, normal_setup: ud->id = mail_get_folderinfo (store, op, update_folders, ud); } - + e_dlist_addtail (&si->folderinfo_updates, (EDListNode *) ud); - + UNLOCK(info_lock); /* there is potential for race here, but it is safe as we check for the store anyway */ diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h index 0b79a335e2..f4c1e1b4db 100644 --- a/mail/mail-folder-cache.h +++ b/mail/mail-folder-cache.h @@ -1,14 +1,14 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* mail-folder-cache.h: Stores information about open folders */ -/* +/* * Authors: Peter Williams <peterw@ximian.com> * Michael Zucchi <notzed@ximian.com> * * Copyright 2000,2001 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, diff --git a/mail/mail-mt.c b/mail/mail-mt.c index 598b6af425..9572d3cd3f 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. @@ -49,7 +49,7 @@ /*#define MALLOC_CHECK*/ #define LOG_OPS #define LOG_LOCKS -#define d(x) +#define d(x) static void set_stop(int sensitive); static void mail_operation_status(struct _CamelOperation *op, const char *what, int pc, void *data); @@ -249,17 +249,17 @@ void mail_msg_check_error(void *msg) struct _mail_msg *m = msg; char *what; GtkDialog *gd; - + #ifdef MALLOC_CHECK checkmem(m); checkmem(m->cancel); checkmem(m->priv); #endif - + /* don't report any errors if we are not in interactive mode */ if (!mail_session_get_interactive ()) return; - + if (!camel_exception_is_set(&m->ex) || m->ex.id == CAMEL_EXCEPTION_USER_CANCEL || m->ex.id == CAMEL_EXCEPTION_FOLDER_INVALID_UID) @@ -336,7 +336,7 @@ int mail_msg_active(unsigned int msgid) int active; MAIL_MT_LOCK(mail_msg_lock); - if (msgid == (unsigned int)-1) + if (msgid == (unsigned int)-1) active = g_hash_table_size(mail_msg_active_table) > 0; else active = g_hash_table_lookup(mail_msg_active_table, GINT_TO_POINTER(msgid)) != NULL; @@ -542,7 +542,7 @@ mail_msg_destroy(EThread *e, EMsg *msg, void *data) checkmem(m); checkmem(m->cancel); checkmem(m->priv); -#endif +#endif mail_msg_free(m); } @@ -734,7 +734,7 @@ int mail_async_event_emit(MailAsyncEvent *ea, mail_async_event_t type, MailAsync m->ea = ea; m->type = type; m->have_thread = FALSE; - + id = m->msg.seq; g_mutex_lock(ea->lock); ea->tasks = g_slist_prepend(ea->tasks, m); @@ -881,7 +881,7 @@ void *mail_call_main(mail_call_t type, MailMainFunc func, ...) ret = m->ret; mail_msg_free(m); - + return ret; } @@ -946,20 +946,20 @@ static void do_op_status(struct _mail_msg *mm) struct _mail_msg_priv *data; char *out, *p, *o, c; int pc; - + g_return_if_fail (pthread_equal(mail_gui_thread, pthread_self ())); - + MAIL_MT_LOCK (mail_msg_lock); - + msg = g_hash_table_lookup (mail_msg_active_table, m->data); if (msg == NULL) { MAIL_MT_UNLOCK (mail_msg_lock); return; } - + data = msg->priv; - + out = alloca (strlen (m->what) * 2 + 1); o = out; p = m->what; @@ -969,22 +969,22 @@ static void do_op_status(struct _mail_msg *mm) *o++ = c; } *o = 0; - + pc = m->pc; - + if (data->activity_id == 0) { char *what; - + /* its being created/removed? well leave it be */ if (data->activity_state == 1 || data->activity_state == 3) { MAIL_MT_UNLOCK (mail_msg_lock); return; } else { data->activity_state = 1; - + if (progress_icon == NULL) progress_icon = e_icon_factory_get_icon ("mail-unread", E_ICON_SIZE_MENU); - + MAIL_MT_UNLOCK (mail_msg_lock); if (msg->ops->describe_msg) what = msg->ops->describe_msg (msg, FALSE); @@ -993,11 +993,11 @@ static void do_op_status(struct _mail_msg *mm) /* uncommenting because message is not very useful for a user, see bug 271734*/ else { what = g_strdup(""); - } - + } + data->activity_id = e_activity_handler_operation_started (activity_handler, "evolution-mail", progress_icon, what, TRUE); - + g_free (what); MAIL_MT_LOCK (mail_msg_lock); if (data->activity_state == 3) { @@ -1011,7 +1011,7 @@ static void do_op_status(struct _mail_msg *mm) camel_exception_clear (&msg->ex); g_free (msg->priv); g_free (msg); - + if (activity_id != 0) mail_async_event_emit (mail_async_event, MAIL_ASYNC_GUI, (MailAsyncFunc) end_event_callback, NULL, GINT_TO_POINTER (activity_id), NULL); @@ -1048,7 +1048,7 @@ static void mail_operation_status (struct _CamelOperation *op, const char *what, int pc, void *data) { struct _op_status_msg *m; - + d(printf("got operation statys: %s %d%%\n", what, pc)); m = mail_msg_new(&op_status_op, NULL, sizeof(*m)); @@ -1073,10 +1073,10 @@ static void set_stop (int sensitive) { static int last = FALSE; - + if (last == sensitive) return; - + /*bonobo_ui_component_set_prop (uic, "/commands/MailStop", "sensitive", sensitive ? "1" : "0", NULL);*/ last = sensitive; } diff --git a/mail/mail-ops.c b/mail/mail-ops.c index f322c02e03..6d02a3108d 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1,7 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* mail-ops.c: callbacks for the mail toolbar/menus */ -/* +/* * Authors: Dan Winship <danw@ximian.com> * Jeffrey Stedfast <fejj@ximian.com> * Peter Williams <peterw@ximian.com> @@ -9,8 +9,8 @@ * * Copyright 2000,2001 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, @@ -70,13 +70,13 @@ #include "mail-vfolder.h" #define w(x) -#define d(x) +#define d(x) /* used for both just filtering a folder + uid's, and for filtering a whole folder */ /* used both for fetching mail, and for filtering mail */ struct _filter_mail_msg { struct _mail_msg msg; - + CamelFolder *source_folder; /* where they come from */ GPtrArray *source_uids; /* uids to copy, or NULL == copy all */ CamelUIDCache *cache; /* UID cache if we are to cache the uids, NULL otherwise */ @@ -113,41 +113,41 @@ em_filter_folder_element_filter (struct _mail_msg *mm) struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; CamelFolder *folder; GPtrArray *uids, *folder_uids = NULL; - + if (m->cancel) camel_operation_register (m->cancel); - + folder = m->source_folder; - + if (folder == NULL || camel_folder_get_message_count (folder) == 0) { if (m->cancel) camel_operation_unregister (m->cancel); return; } - + if (m->destination) { camel_folder_freeze (m->destination); camel_filter_driver_set_default_folder (m->driver, m->destination); } - + camel_folder_freeze (folder); - + if (m->source_uids) uids = m->source_uids; else folder_uids = uids = camel_folder_get_uids (folder); - + camel_filter_driver_filter_folder (m->driver, folder, m->cache, uids, m->delete, &mm->ex); camel_filter_driver_flush (m->driver, &mm->ex); - + if (folder_uids) camel_folder_free_uids (folder, folder_uids); - + /* sync our source folder */ if (!m->cache) camel_folder_sync (folder, FALSE, camel_exception_is_set (&mm->ex) ? NULL : &mm->ex); camel_folder_thaw (folder); - + if (m->destination) camel_folder_thaw (m->destination); @@ -155,7 +155,7 @@ em_filter_folder_element_filter (struct _mail_msg *mm) see also fetch_mail_fetch() below */ camel_object_unref(m->driver); m->driver = NULL; - + if (m->cancel) camel_operation_unregister (m->cancel); } @@ -169,22 +169,22 @@ static void em_filter_folder_element_free (struct _mail_msg *mm) { struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; - + if (m->source_folder) camel_object_unref (m->source_folder); - + if (m->source_uids) em_utils_uids_free (m->source_uids); - + if (m->cancel) camel_operation_unref (m->cancel); - + if (m->destination) camel_object_unref (m->destination); - + if (m->driver) camel_object_unref (m->driver); - + mail_session_flush_filter_log (); } @@ -201,7 +201,7 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids, CamelOperation *cancel) { struct _filter_mail_msg *m; - + m = mail_msg_new (&em_filter_folder_element_op, NULL, sizeof (*m)); m->source_folder = source_folder; camel_object_ref (source_folder); @@ -212,15 +212,15 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids, m->cancel = cancel; camel_operation_ref (cancel); } - + m->driver = camel_session_get_filter_driver (session, type, NULL); - + if (!notify) { /* FIXME: have a #define NOTIFY_FILTER_NAME macro? */ /* the filter name has to stay in sync with mail-session::get_filter_driver */ camel_filter_driver_remove_rule_by_name (m->driver, "new-mail-notification"); } - + e_thread_put (mail_thread_new, (EMsg *)m); } @@ -246,17 +246,17 @@ uid_cachename_hack (CamelStore *store) CamelURL *url = CAMEL_SERVICE (store)->url; char *encoded_url, *filename; const char *evolution_dir; - + encoded_url = g_strdup_printf ("%s%s%s@%s", url->user, url->authmech ? ";auth=" : "", url->authmech ? url->authmech : "", url->host); e_filename_make_safe (encoded_url); - + evolution_dir = mail_component_peek_base_directory (mail_component_peek ()); filename = g_build_filename (evolution_dir, "mail", "pop", encoded_url, "uid-cache", NULL); g_free (encoded_url); - + return filename; } @@ -275,7 +275,7 @@ fetch_mail_fetch (struct _mail_msg *mm) if (m->cancel) camel_operation_register (m->cancel); - + if ((fm->destination = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_LOCAL_INBOX)) == NULL) goto fail; camel_object_ref(fm->destination); @@ -284,33 +284,33 @@ fetch_mail_fetch (struct _mail_msg *mm) access thingy, right? problem is matching raw messages to uid's etc. */ if (!strncmp (m->source_uri, "mbox:", 5)) { char *path = mail_tool_do_movemail (m->source_uri, &mm->ex); - + if (path && !camel_exception_is_set (&mm->ex)) { camel_folder_freeze (fm->destination); camel_filter_driver_set_default_folder (fm->driver, fm->destination); camel_filter_driver_filter_mbox (fm->driver, path, m->source_uri, &mm->ex); camel_folder_thaw (fm->destination); - + if (!camel_exception_is_set (&mm->ex)) g_unlink (path); } g_free (path); } else { CamelFolder *folder = fm->source_folder = mail_tool_get_inbox (m->source_uri, &mm->ex); - + if (folder) { /* this handles 'keep on server' stuff, if we have any new uid's to copy across, we need to copy them to a new array 'cause of the way fetch_mail_free works */ CamelUIDCache *cache = NULL; char *cachename; - + cachename = uid_cachename_hack (folder->parent_store); cache = camel_uid_cache_new (cachename); g_free (cachename); - + if (cache) { GPtrArray *folder_uids, *cache_uids, *uids; - + folder_uids = camel_folder_get_uids (folder); cache_uids = camel_uid_cache_get_new_uids (cache, folder_uids); if (cache_uids) { @@ -320,10 +320,10 @@ fetch_mail_fetch (struct _mail_msg *mm) for (i = 0; i < cache_uids->len; i++) uids->pdata[i] = g_strdup (cache_uids->pdata[i]); camel_uid_cache_free_uids (cache_uids); - + fm->cache = cache; em_filter_folder_element_filter (mm); - + /* need to uncancel so writes/etc. don't fail */ if (mm->ex.id == CAMEL_EXCEPTION_USER_CANCEL) camel_operation_uncancel(NULL); @@ -350,7 +350,7 @@ fetch_mail_fetch (struct _mail_msg *mm) } else { em_filter_folder_element_filter (mm); } - + /* we unref the source folder here since we may now block in finalize (we try to disconnect cleanly) */ @@ -358,10 +358,10 @@ fetch_mail_fetch (struct _mail_msg *mm) fm->source_folder = NULL; } } -fail: +fail: if (m->cancel) camel_operation_unregister (m->cancel); - + /* 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) */ @@ -384,7 +384,7 @@ static void fetch_mail_free (struct _mail_msg *mm) { struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm; - + g_free (m->source_uri); if (m->cancel) camel_operation_unref (m->cancel); @@ -408,7 +408,7 @@ mail_fetch_mail (const char *source, int keep, const char *type, CamelOperation { struct _fetch_mail_msg *m; struct _filter_mail_msg *fm; - + m = mail_msg_new (&fetch_mail_op, NULL, sizeof (*m)); fm = (struct _filter_mail_msg *)m; m->source_uri = g_strdup (source); @@ -425,7 +425,7 @@ mail_fetch_mail (const char *source, int keep, const char *type, CamelOperation camel_filter_driver_set_folder_func (fm->driver, get_folder, get_data); if (status) camel_filter_driver_set_status_func (fm->driver, status, status_data); - + e_thread_put (mail_thread_new, (EMsg *)m); } @@ -475,19 +475,19 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination, tmp = camel_header_raw_find(&xev, "X-Evolution-Account", NULL); if (tmp) { char *name; - + name = g_strstrip(g_strdup(tmp)); if ((account = mail_config_get_account_by_uid(name)) /* 'old' x-evolution-account stored the name, how silly */ || (account = mail_config_get_account_by_name(name))) { if (account->transport && account->transport->url) transport_url = g_strdup (account->transport->url); - + sent_folder_uri = g_strdup (account->sent_folder_uri); } g_free(name); } - + if (!account) { /* default back to these headers */ tmp = camel_header_raw_find(&xev, "X-Evolution-Transport", NULL); @@ -508,11 +508,11 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination, iaddr = camel_mime_message_get_from (message); camel_address_copy (from, CAMEL_ADDRESS (iaddr)); } - + recipients = (CamelAddress *) camel_internet_address_new (); for (i = 0; i < 3; i++) { const char *type; - + type = resent_from ? resent_recipients[i] : normal_recipients[i]; iaddr = camel_mime_message_get_recipients (message, type); camel_address_cat (recipients, CAMEL_ADDRESS (iaddr)); @@ -553,25 +553,25 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination, /* post process */ mail_tool_restore_xevolution_headers (message, xev); - + if (driver) { camel_filter_driver_filter_message (driver, message, info, NULL, NULL, NULL, "", ex); - + if (camel_exception_is_set (ex)) { if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) goto exit; - + /* sending mail, filtering failed */ g_string_append_printf (err, _("Failed to apply outgoing filters: %s"), camel_exception_get_description (ex)); } } - + camel_exception_clear (ex); if (xport == NULL - || !( ((CamelService *)xport)->provider->flags & CAMEL_PROVIDER_DISABLE_SENT_FOLDER)) { + || !( ((CamelService *)xport)->provider->flags & CAMEL_PROVIDER_DISABLE_SENT_FOLDER)) { if (sent_folder_uri) { folder = mail_tool_uri_to_folder (sent_folder_uri, 0, ex); if (camel_exception_is_set(ex)) { @@ -583,7 +583,7 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination, } if (!folder) { - folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT); + folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT); camel_object_ref(folder); } @@ -633,7 +633,7 @@ mail_send_message(CamelFolder *queue, const char *uid, const char *destination, /* set the culmulative exception report */ camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, err->str); } - + exit: if (folder) { camel_folder_sync(folder, FALSE, NULL); @@ -678,7 +678,7 @@ report_status (struct _send_queue_msg *m, enum camel_filter_status_t status, int { va_list ap; char *str; - + if (m->status) { va_start (ap, desc); str = g_strdup_vprintf (desc, ap); @@ -696,16 +696,16 @@ send_queue_send(struct _mail_msg *mm) GPtrArray *uids, *send_uids = NULL; CamelException ex; int i, j; - + d(printf("sending queue\n")); - + if (!(uids = camel_folder_get_uids (m->queue))) return; send_uids = g_ptr_array_sized_new (uids->len); for (i = 0, j = 0; i < uids->len; i++) { CamelMessageInfo *info; - + info = camel_folder_get_message_info (m->queue, uids->pdata[i]); if (info) { if ((camel_message_info_flags(info) & CAMEL_MESSAGE_DELETED) == 0) @@ -713,7 +713,7 @@ send_queue_send(struct _mail_msg *mm) camel_folder_free_message_info(m->queue, info); } } - + send_uids->len = j; if (send_uids->len == 0) { /* nothing to send */ @@ -721,10 +721,10 @@ send_queue_send(struct _mail_msg *mm) g_ptr_array_free (send_uids, TRUE); return; } - + if (m->cancel) camel_operation_register (m->cancel); - + camel_exception_init (&ex); /* NB: This code somewhat abuses the 'exception' stuff. Apart from fatal problems, it is also @@ -732,9 +732,9 @@ send_queue_send(struct _mail_msg *mm) for (i = 0, j = 0; i < send_uids->len; i++) { int pc = (100 * i) / send_uids->len; - + report_status (m, CAMEL_FILTER_STATUS_START, pc, _("Sending message %d of %d"), i+1, send_uids->len); - + mail_send_message (m->queue, send_uids->pdata[i], m->destination, m->driver, &ex); if (camel_exception_is_set (&ex)) { if (ex.id != CAMEL_EXCEPTION_USER_CANCEL) { @@ -744,7 +744,7 @@ send_queue_send(struct _mail_msg *mm) else camel_exception_xfer (&mm->ex, &ex); camel_exception_clear (&ex); - + /* keep track of the number of failures */ j++; } else { @@ -754,16 +754,16 @@ send_queue_send(struct _mail_msg *mm) } } } - + j += (send_uids->len - i); - + if (j > 0) report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Failed to send %d of %d messages"), j, send_uids->len); else if (mm->ex.id == CAMEL_EXCEPTION_USER_CANCEL) report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Canceled.")); else report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete.")); - + if (m->driver) { camel_object_unref (m->driver); m->driver = NULL; @@ -774,12 +774,12 @@ send_queue_send(struct _mail_msg *mm) camel_folder_sync (m->queue, TRUE, &ex); camel_exception_clear (&ex); - + if (sent_folder) { camel_folder_sync (sent_folder, FALSE, &ex); camel_exception_clear (&ex); } - + if (m->cancel) camel_operation_unregister (m->cancel); } @@ -797,7 +797,7 @@ static void send_queue_free(struct _mail_msg *mm) { struct _send_queue_msg *m = (struct _send_queue_msg *)mm; - + if (m->driver) camel_object_unref(m->driver); camel_object_unref(m->queue); @@ -903,10 +903,10 @@ mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageIn void *data) { struct _append_msg *m; - + g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); - + if (!camel_medium_get_header (CAMEL_MEDIUM (message), "X-Mailer")) camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer", "Evolution " VERSION SUB_VERSION " " VERSION_COMMENT); @@ -917,10 +917,10 @@ mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageIn m->message = message; camel_object_ref(message); m->info = info; - + m->done = done; m->data = data; - + e_thread_put (mail_thread_new, (EMsg *)m); } @@ -934,7 +934,7 @@ struct _transfer_msg { gboolean delete; char *dest_uri; guint32 dest_flags; - + void (*done)(gboolean ok, void *data); void *data; }; @@ -946,7 +946,7 @@ transfer_messages_desc (struct _mail_msg *mm, int done) return g_strdup_printf(m->delete?_("Moving messages to %s"):_("Copying messages to %s"), m->dest_uri); - + } static void @@ -976,7 +976,7 @@ transfer_messages_transfer (struct _mail_msg *mm) int i; for (i = 0; i < m->uids->len; i++) - camel_folder_set_message_flags (m->source, m->uids->pdata[i], + camel_folder_set_message_flags (m->source, m->uids->pdata[i], CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); } @@ -990,7 +990,7 @@ static void transfer_messages_transferred (struct _mail_msg *mm) { struct _transfer_msg *m = (struct _transfer_msg *)mm; - + if (m->done) m->done (!camel_exception_is_set (&mm->ex), m->data); } @@ -999,7 +999,7 @@ static void transfer_messages_free (struct _mail_msg *mm) { struct _transfer_msg *m = (struct _transfer_msg *)mm; - + camel_object_unref (m->source); g_free (m->dest_uri); em_utils_uids_free (m->uids); @@ -1021,11 +1021,11 @@ mail_transfer_messages (CamelFolder *source, GPtrArray *uids, void *data) { struct _transfer_msg *m; - + g_return_if_fail (CAMEL_IS_FOLDER (source)); g_return_if_fail (uids != NULL); g_return_if_fail (dest_uri != NULL); - + m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m)); m->source = source; camel_object_ref (source); @@ -1035,7 +1035,7 @@ mail_transfer_messages (CamelFolder *source, GPtrArray *uids, m->dest_flags = dest_flags; m->done = done; m->data = data; - + e_thread_put(mail_thread_queued_slow, (EMsg *)m); } @@ -1067,7 +1067,7 @@ get_folderinfo_get (struct _mail_msg *mm) { struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_SUBSCRIBED; - + m->info = camel_store_get_folder_info (m->store, NULL, flags, &mm->ex); } @@ -1075,16 +1075,16 @@ static void get_folderinfo_got (struct _mail_msg *mm) { struct _get_folderinfo_msg *m = (struct _get_folderinfo_msg *)mm; - + if (!m->info && camel_exception_is_set (&mm->ex)) { char *url; - + url = camel_service_get_url (CAMEL_SERVICE (m->store)); w(g_warning ("Error getting folder info from store at %s: %s", url, camel_exception_get_description (&mm->ex))); g_free (url); } - + if (m->done) m->done (m->store, m->info, m->data); } @@ -1197,7 +1197,7 @@ mail_build_attachment(CamelFolder *folder, GPtrArray *uids, struct _get_folder_msg { struct _mail_msg msg; - + char *uri; guint32 flags; CamelFolder *folder; @@ -1209,7 +1209,7 @@ static char * get_folder_desc (struct _mail_msg *mm, int done) { struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - + return g_strdup_printf(_("Opening folder %s"), m->uri); } @@ -1217,7 +1217,7 @@ static void get_folder_get (struct _mail_msg *mm) { struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - + m->folder = mail_tool_uri_to_folder (m->uri, m->flags, &mm->ex); } @@ -1225,7 +1225,7 @@ static void get_folder_got (struct _mail_msg *mm) { struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - + if (m->done) m->done (m->uri, m->folder, m->data); } @@ -1234,7 +1234,7 @@ static void get_folder_free (struct _mail_msg *mm) { struct _get_folder_msg *m = (struct _get_folder_msg *)mm; - + g_free (m->uri); if (m->folder) camel_object_unref (m->folder); @@ -1254,13 +1254,13 @@ mail_get_folder (const char *uri, guint32 flags, { struct _get_folder_msg *m; int id; - + m = mail_msg_new(&get_folder_op, NULL, sizeof(*m)); m->uri = g_strdup (uri); m->flags = flags; m->data = data; m->done = done; - + id = m->msg.seq; e_thread_put(thread, (EMsg *)m); return id; @@ -1281,7 +1281,7 @@ static char * get_store_desc (struct _mail_msg *mm, int done) { struct _get_store_msg *m = (struct _get_store_msg *)mm; - + return g_strdup_printf(_("Opening store %s"), m->uri); } @@ -1289,7 +1289,7 @@ static void get_store_get (struct _mail_msg *mm) { struct _get_store_msg *m = (struct _get_store_msg *)mm; - + /*camel_session_get_store connects us, which we don't want to do on startup. */ m->store = (CamelStore *) camel_session_get_service (session, m->uri, @@ -1310,7 +1310,7 @@ static void get_store_free (struct _mail_msg *mm) { struct _get_store_msg *m = (struct _get_store_msg *)mm; - + g_free (m->uri); if (m->store) camel_object_unref (m->store); @@ -1328,7 +1328,7 @@ mail_get_store (const char *uri, CamelOperation *op, void (*done) (char *uri, Ca { struct _get_store_msg *m; int id; - + m = mail_msg_new (&get_store_op, NULL, sizeof (*m)); if (op) { camel_operation_unref(m->msg.cancel); @@ -1338,7 +1338,7 @@ mail_get_store (const char *uri, CamelOperation *op, void (*done) (char *uri, Ca m->uri = g_strdup (uri); m->data = data; m->done = done; - + id = m->msg.seq; e_thread_put (mail_thread_new, (EMsg *)m); return id; @@ -1359,7 +1359,7 @@ static char * remove_folder_desc (struct _mail_msg *mm, int done) { struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; - + return g_strdup_printf (_("Removing folder %s"), m->uri); } @@ -1371,15 +1371,15 @@ remove_folder_get (struct _mail_msg *mm) CamelFolder *folder; GPtrArray *uids; int i; - + m->removed = FALSE; - + folder = mail_tool_uri_to_folder (m->uri, 0, &mm->ex); if (!folder) return; - + store = folder->parent_store; - + /* Delete every message in this folder, then expunge it */ uids = camel_folder_get_uids (folder); camel_folder_freeze(folder); @@ -1388,11 +1388,11 @@ remove_folder_get (struct _mail_msg *mm) camel_folder_sync (folder, TRUE, NULL); camel_folder_thaw(folder); camel_folder_free_uids (folder, uids); - + /* if the store supports subscriptions, unsubscribe from this folder... */ if (camel_store_supports_subscriptions (store)) camel_store_unsubscribe_folder (store, folder->full_name, NULL); - + /* Then delete the folder from the store */ camel_store_delete_folder (store, folder->full_name, &mm->ex); m->removed = !camel_exception_is_set (&mm->ex); @@ -1416,7 +1416,7 @@ static void remove_folder_free (struct _mail_msg *mm) { struct _remove_folder_msg *m = (struct _remove_folder_msg *)mm; - + g_free (m->uri); } @@ -1431,12 +1431,12 @@ void mail_remove_folder (const char *uri, void (*done) (char *uri, gboolean removed, void *data), void *data) { struct _remove_folder_msg *m; - + m = mail_msg_new (&remove_folder_op, NULL, sizeof (*m)); m->uri = g_strdup (uri); m->data = data; m->done = done; - + e_thread_put (mail_thread_new, (EMsg *)m); } @@ -1454,7 +1454,7 @@ static char *sync_folder_desc(struct _mail_msg *mm, int done) { struct _sync_folder_msg *m = (struct _sync_folder_msg *)mm; - return g_strdup_printf (_("Storing folder \'%s\'"), + return g_strdup_printf (_("Storing folder \'%s\'"), camel_folder_get_full_name (m->folder)); } @@ -1659,7 +1659,7 @@ static char *empty_trash_desc(struct _mail_msg *mm, int done) #if 0 struct _empty_trash_msg *m = (struct _empty_trash_msg *)mm; - return g_strdup_printf (_("Emptying trash in \'%s\'"), + return g_strdup_printf (_("Emptying trash in \'%s\'"), m->account ? m->account->name : _("Local Folders")); #else return g_strdup(_("Expunging folder")); @@ -1672,7 +1672,7 @@ static void empty_trash_empty(struct _mail_msg *mm) const char *evolution_dir; CamelFolder *trash; char *uri; - + if (m->account) { trash = mail_tool_get_trash (m->account->source->url, FALSE, &mm->ex); } else { @@ -1681,10 +1681,10 @@ static void empty_trash_empty(struct _mail_msg *mm) trash = mail_tool_get_trash (uri, TRUE, &mm->ex); g_free (uri); } - + if (trash) camel_folder_expunge (trash, &mm->ex); - + camel_object_unref (trash); } @@ -1764,11 +1764,11 @@ static void get_message_got(struct _mail_msg *mm) static void get_message_free(struct _mail_msg *mm) { struct _get_message_msg *m = (struct _get_message_msg *)mm; - + g_free (m->uid); camel_object_unref (m->folder); camel_operation_unref (m->cancel); - + if (m->message) camel_object_unref (m->message); } @@ -1786,7 +1786,7 @@ mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder void *data, EThread *thread) { struct _get_message_msg *m; - + m = mail_msg_new(&get_message_op, NULL, sizeof(*m)); m->folder = folder; camel_object_ref(folder); @@ -1794,7 +1794,7 @@ mail_get_message(CamelFolder *folder, const char *uid, void (*done) (CamelFolder m->data = data; m->done = (void (*) (CamelFolder *, const char *, CamelMimeMessage *, void *)) done; m->cancel = camel_operation_new(NULL, NULL); - + e_thread_put(thread, (EMsg *)m); } @@ -1824,7 +1824,7 @@ mail_get_messagex(CamelFolder *folder, const char *uid, void (*done) (CamelFolde void *data, EThread *thread) { struct _get_message_msg *m; - + m = mail_msg_new(&get_messagex_op, NULL, sizeof(*m)); m->folder = folder; camel_object_ref(folder); @@ -1832,7 +1832,7 @@ mail_get_messagex(CamelFolder *folder, const char *uid, void (*done) (CamelFolde m->data = data; m->done = (void (*) (CamelFolder *, const char *, CamelMimeMessage *, void *)) done; m->cancel = camel_operation_new(NULL, NULL); - + e_thread_put(thread, (EMsg *)m); } @@ -1854,7 +1854,7 @@ static char * get_messages_desc(struct _mail_msg *mm, int done) struct _get_messages_msg *m = (struct _get_messages_msg *)mm; return g_strdup_printf(ngettext("Retrieving %d message", - "Retrieving %d messages", m->uids->len), + "Retrieving %d messages", m->uids->len), m->uids->len); } @@ -1888,7 +1888,7 @@ static void get_messages_free(struct _mail_msg *mm) { struct _get_messages_msg *m = (struct _get_messages_msg *)mm; int i; - + em_utils_uids_free (m->uids); for (i=0;i<m->messages->len;i++) { if (m->messages->pdata[i]) @@ -1939,8 +1939,8 @@ static char *save_messages_desc(struct _mail_msg *mm, int done) { struct _save_messages_msg *m = (struct _save_messages_msg *)mm; - return g_strdup_printf(ngettext("Saving %d message", - "Saving %d messsages", m->uids->len), + return g_strdup_printf(ngettext("Saving %d message", + "Saving %d messsages", m->uids->len), m->uids->len); } @@ -1949,16 +1949,16 @@ save_prepare_part (CamelMimePart *mime_part) { CamelDataWrapper *wrapper; int parts, i; - + wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); if (!wrapper) return; - + if (CAMEL_IS_MULTIPART (wrapper)) { parts = camel_multipart_get_number (CAMEL_MULTIPART (wrapper)); for (i = 0; i < parts; i++) { CamelMimePart *part = camel_multipart_get_part (CAMEL_MULTIPART (wrapper), i); - + save_prepare_part (part); } } else { @@ -1967,7 +1967,7 @@ save_prepare_part (CamelMimePart *mime_part) save_prepare_part (CAMEL_MIME_PART (wrapper)); } else { CamelContentType *type; - + /* We want to save textual parts as 8bit instead of encoded */ type = camel_data_wrapper_get_mime_type_field (wrapper); if (camel_content_type_is (type, "text", "*")) @@ -1985,13 +1985,13 @@ save_messages_save (struct _mail_msg *mm) CamelStream *stream; int i; char *from; - + stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666); from_filter = camel_mime_filter_from_new(); filtered_stream = camel_stream_filter_new_with_stream(stream); camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)from_filter); camel_object_unref(from_filter); - + for (i=0; i<m->uids->len; i++) { CamelMimeMessage *message; int pc = ((i+1) * 100) / m->uids->len; @@ -2000,9 +2000,9 @@ save_messages_save (struct _mail_msg *mm) camel_operation_progress(mm->cancel, pc); if (message == NULL) break; - + save_prepare_part (CAMEL_MIME_PART (message)); - + /* we need to flush after each stream write since we are writing to the same fd */ from = camel_mime_message_build_mbox_from(message); if (camel_stream_write_string(stream, from) == -1 @@ -2034,7 +2034,7 @@ static void save_messages_saved(struct _mail_msg *mm) static void save_messages_free(struct _mail_msg *mm) { struct _save_messages_msg *m = (struct _save_messages_msg *)mm; - + em_utils_uids_free (m->uids); camel_object_unref(m->folder); g_free(m->path); @@ -2091,7 +2091,7 @@ save_part_save (struct _mail_msg *mm) struct _save_part_msg *m = (struct _save_part_msg *)mm; CamelDataWrapper *content; CamelStream *stream; - + if(!m->readonly){ if (!(stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0644))) { camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, @@ -2105,15 +2105,15 @@ save_part_save (struct _mail_msg *mm) m->path, g_strerror (errno)); return; } - + content = camel_medium_get_content_object (CAMEL_MEDIUM (m->part)); - + if (camel_data_wrapper_decode_to_stream (content, stream) == -1 || camel_stream_flush (stream) == -1) camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, _("Could not write data: %s"), g_strerror (errno)); - + camel_object_unref (stream); } @@ -2121,7 +2121,7 @@ static void save_part_saved (struct _mail_msg *mm) { struct _save_part_msg *m = (struct _save_part_msg *)mm; - + if (m->done) m->done (m->part, m->path, !camel_exception_is_set (&mm->ex), m->data); } @@ -2154,10 +2154,10 @@ mail_save_part (CamelMimePart *part, const char *path, m->data = data; m->done = done; m->readonly = readonly; - + id = m->msg.seq; e_thread_put (mail_thread_new, (EMsg *)m); - + return id; } @@ -2422,7 +2422,7 @@ mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, vo { if (argc <= 0) return; - + gnome_execute_async_fds (NULL, argc, argv, TRUE); } @@ -2490,13 +2490,13 @@ mail_check_service(const char *url, CamelProviderType type, void (*done)(const c { struct _check_msg *m; int id; - + m = mail_msg_new (&check_service_op, NULL, sizeof(*m)); m->url = g_strdup(url); m->type = type; m->done = done; m->data = data; - + id = m->msg.seq; e_thread_put(mail_thread_new, (EMsg *)m); diff --git a/mail/mail-ops.h b/mail/mail-ops.h index ba886688c1..18fca3be5c 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -1,14 +1,14 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: +/* + * Authors: * Peter Williams <peterw@ximian.com> * Michael Zucchi <notzed@ximian.com> * * Copyright 2000, 2001 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 35541673d8..136f9e9051 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -159,7 +159,7 @@ static struct _send_data * setup_send_data(void) { struct _send_data *data; - + if (send_data == NULL) { send_data = data = g_malloc0(sizeof(*data)); data->lock = g_mutex_new(); @@ -320,7 +320,7 @@ format_url(const char *internal_url, const char *account_name) pretty_url = g_strdup_printf("<b>%s (%s)</b>: %s", account_name, url->protocol, url->host); else if (url->path) pretty_url = g_strdup_printf("<b>%s (%s)</b>: %s", account_name, url->protocol, url->path); - else + else pretty_url = g_strdup_printf("<b>%s (%s)</b>", account_name, url->protocol); } else { @@ -328,7 +328,7 @@ format_url(const char *internal_url, const char *account_name) pretty_url = g_strdup_printf("<b>%s</b>: %s", url->protocol, url->host); else if (url->path) pretty_url = g_strdup_printf("<b>%s</b>: %s", url->protocol, url->path); - else + else pretty_url = g_strdup_printf("<b>%s</b>", url->protocol); } camel_url_free(url); @@ -353,7 +353,7 @@ get_receive_type(const char *url) if (!provider) return SEND_INVALID; - + if (provider->object_types[CAMEL_PROVIDER_STORE]) { if (provider->flags & CAMEL_PROVIDER_IS_STORAGE) return SEND_UPDATE; @@ -362,7 +362,7 @@ get_receive_type(const char *url) } else if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) { return SEND_SEND; } - + return SEND_INVALID; } @@ -376,7 +376,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati struct _send_data *data; GtkWidget *send_icon; GtkWidget *recv_icon; - GtkWidget *scrolled_window; + GtkWidget *scrolled_window; GtkWidget *label; GtkWidget *status_label; GtkWidget *progress_bar; @@ -390,7 +390,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati gd = (GtkDialog *)(send_recv_dialog = gtk_dialog_new_with_buttons(_("Send & Receive Mail"), NULL, GTK_DIALOG_NO_SEPARATOR, NULL)); gtk_window_set_modal ((GtkWindow *) gd, FALSE); - + gtk_widget_ensure_style ((GtkWidget *)gd); gtk_container_set_border_width ((GtkContainer *)gd->vbox, 0); gtk_container_set_border_width ((GtkContainer *)gd->action_area, 6); @@ -402,34 +402,34 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON)); gtk_widget_show (cancel_button); gtk_dialog_add_action_widget (gd, cancel_button, GTK_RESPONSE_CANCEL); - + icon_list = e_icon_factory_get_icon_list ("mail-send-receive"); if (icon_list) { gtk_window_set_icon_list (GTK_WINDOW (gd), icon_list); g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); g_list_free (icon_list); } - + num_sources = 0; - + iter = e_list_get_iterator ((EList *) accounts); while (e_iterator_is_valid (iter)) { account = (EAccount *) e_iterator_get (iter); - + if (account->source->url) num_sources++; - + e_iterator_next (iter); } - + g_object_unref (iter); - + table = gtk_table_new (num_sources, 4, FALSE); gtk_container_set_border_width (GTK_CONTAINER (table), 6); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); - scrolled_window = gtk_scrolled_window_new (NULL, NULL); + scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); @@ -437,48 +437,48 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati gtk_scrolled_window_add_with_viewport ( GTK_SCROLLED_WINDOW (scrolled_window), table); gtk_box_pack_start ( - GTK_BOX (gd->vbox), scrolled_window, TRUE, TRUE, 0); + GTK_BOX (gd->vbox), scrolled_window, TRUE, TRUE, 0); gtk_widget_set_size_request (gd->vbox, 600, 200); - gtk_widget_show (scrolled_window); + gtk_widget_show (scrolled_window); /* must bet setup after send_recv_dialog as it may re-trigger send-recv button */ data = setup_send_data (); - + row = 0; iter = e_list_get_iterator ((EList *) accounts); while (e_iterator_is_valid (iter)) { EAccountService *source; - + account = (EAccount *) e_iterator_get (iter); - + source = account->source; if (!account->enabled || !source->url) { e_iterator_next (iter); continue; } - + /* see if we have an outstanding download active */ info = g_hash_table_lookup (data->active, source->url); if (info == NULL) { send_info_t type; - + type = get_receive_type (source->url); if (type == SEND_INVALID || type == SEND_SEND) { e_iterator_next (iter); continue; } - + info = g_malloc0 (sizeof (*info)); info->type = type; - + d(printf("adding source %s\n", source->url)); - + info->uri = g_strdup (source->url); info->keep = source->keep_on_server; info->cancel = camel_operation_new (operation_status, info); info->state = SEND_ACTIVE; info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info); - + g_hash_table_insert (data->active, info->uri, info); list = g_list_prepend (list, info); } else if (info->progress_bar != NULL) { @@ -487,7 +487,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati continue; } else if (info->timeout_id == 0) info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info); - + recv_icon = e_icon_factory_get_image ( "mail-inbox", E_ICON_SIZE_LARGE_TOOLBAR); pretty_url = format_url (source->url, account->name); @@ -496,9 +496,9 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati GTK_LABEL (label), PANGO_ELLIPSIZE_END); gtk_label_set_markup (GTK_LABEL (label), pretty_url); g_free (pretty_url); - + progress_bar = gtk_progress_bar_new (); - + cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); status_label = gtk_label_new ( @@ -510,7 +510,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati /* g_object_set(data->label, "bold", TRUE, NULL); */ gtk_misc_set_alignment (GTK_MISC (label), 0, .5); gtk_misc_set_alignment (GTK_MISC (status_label), 0, .5); - + gtk_table_attach ( GTK_TABLE (table), recv_icon, 0, 1, row, row+2, 0, 0, 0, 0); @@ -526,43 +526,43 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati gtk_table_attach ( GTK_TABLE (table), status_label, 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0); - + info->progress_bar = progress_bar; info->status_label = status_label; info->cancel_button = cancel_button; info->data = data; - + g_signal_connect ( cancel_button, "clicked", G_CALLBACK (receive_cancel), info); e_iterator_next (iter); row = row + 2; } - + g_object_unref (iter); - + /* Hook: If some one wants to hook on to the sendreceive dialog, this is the way to go. */ target = em_event_target_new_send_receive (em_event_peek(), table, data, row, EM_EVENT_SEND_RECEIVE); e_event_emit ((EEvent *)em_event_peek (), "mail.sendreceive", (EEventTarget *) target); - + if (outbox && destination) { info = g_hash_table_lookup (data->active, SEND_URI_KEY); if (info == NULL) { info = g_malloc0 (sizeof (*info)); info->type = SEND_SEND; d(printf("adding dest %s\n", destination)); - + info->uri = g_strdup (destination); info->keep = FALSE; info->cancel = camel_operation_new (operation_status, info); info->state = SEND_ACTIVE; info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info); - + g_hash_table_insert (data->active, SEND_URI_KEY, info); list = g_list_prepend (list, info); } else if (info->timeout_id == 0) info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info); - + send_icon = e_icon_factory_get_image ( "mail-outbox", E_ICON_SIZE_LARGE_TOOLBAR); pretty_url = format_url (destination, NULL); @@ -572,7 +572,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati gtk_label_set_markup (GTK_LABEL (label), pretty_url); g_free (pretty_url); - + progress_bar = gtk_progress_bar_new (); cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); @@ -582,7 +582,7 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati gtk_misc_set_alignment (GTK_MISC (label), 0, .5); gtk_misc_set_alignment (GTK_MISC (status_label), 0, .5); - + gtk_table_attach ( GTK_TABLE (table), send_icon, 0, 1, row, row+2, 0, 0, 0, 0); @@ -598,27 +598,27 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati gtk_table_attach ( GTK_TABLE (table), status_label, 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0); - + info->progress_bar = progress_bar; info->cancel_button = cancel_button; info->data = data; info->status_label = status_label; - + g_signal_connect ( cancel_button, "clicked", G_CALLBACK (receive_cancel), info); gtk_widget_show_all (table); } - + gtk_widget_show (GTK_WIDGET (gd)); - + g_signal_connect (gd, "response", G_CALLBACK (dialog_response), data); - + g_object_weak_ref ((GObject *) gd, (GWeakNotify) dialog_destroy_cb, data); - + data->infos = list; data->gd = gd; - + return data; } @@ -752,7 +752,7 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep /* we recheck that the folder hasn't snuck in while we were loading it... */ /* and we assume the newer one is the same, but unref the old one anyway */ g_mutex_lock(info->data->lock); - + if (g_hash_table_lookup_extended (info->data->folders, uri, &oldkey, &oldinfoptr)) { oldinfo = (struct _folder_info *) oldinfoptr; camel_object_unref(oldinfo->folder); @@ -764,11 +764,11 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep oldinfo->uri = g_strdup(uri); g_hash_table_insert(info->data->folders, oldinfo->uri, oldinfo); } - + camel_object_ref (folder); - + g_mutex_unlock(info->data->lock); - + return folder; } @@ -885,7 +885,7 @@ static void receive_update_got_store (char *uri, CamelStore *store, void *data) { struct _send_info *info = data; - + if (store) { mail_note_store(store, info->cancel, receive_update_got_folderinfo, info); } else { @@ -901,7 +901,7 @@ mail_send_receive (void) EAccountList *accounts; EAccount *account; GList *scan; - + if (send_recv_dialog != NULL) { if (GTK_WIDGET_REALIZED(send_recv_dialog)) { gdk_window_show(send_recv_dialog->window); @@ -909,14 +909,14 @@ mail_send_receive (void) } return send_recv_dialog; } - + if (!camel_session_is_online (session)) return send_recv_dialog; - + account = mail_config_get_default_account (); if (!account || !account->transport->url) return send_recv_dialog; - + accounts = mail_config_get_accounts (); outbox_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX); @@ -924,7 +924,7 @@ mail_send_receive (void) scan = data->infos; while (scan) { struct _send_info *info = scan->data; - + switch(info->type) { case SEND_RECEIVE: mail_fetch_mail(info->uri, info->keep, @@ -1093,22 +1093,22 @@ mail_receive_uri (const char *uri, int keep) struct _send_data *data; CamelFolder *outbox_folder; send_info_t type; - + data = setup_send_data(); info = g_hash_table_lookup(data->active, uri); if (info != NULL) { d(printf("download of %s still in progress\n", uri)); return; } - + d(printf("starting non-interactive download of '%s'\n", uri)); - + type = get_receive_type (uri); if (type == SEND_INVALID || type == SEND_SEND) { d(printf ("unsupported provider: '%s'\n", uri)); return; } - + info = g_malloc0 (sizeof (*info)); info->type = type; info->progress_bar = NULL; @@ -1120,11 +1120,11 @@ mail_receive_uri (const char *uri, int keep) info->data = data; info->state = SEND_ACTIVE; info->timeout_id = 0; - + d(printf("Adding new info %p\n", info)); - + g_hash_table_insert (data->active, info->uri, info); - + switch (info->type) { case SEND_RECEIVE: mail_fetch_mail (info->uri, info->keep, @@ -1160,11 +1160,11 @@ mail_send (void) struct _send_info *info; struct _send_data *data; send_info_t type; - + transport = mail_config_get_default_transport (); - if (!transport || !transport->url) + if (!transport || !transport->url) return; - + data = setup_send_data (); info = g_hash_table_lookup (data->active, SEND_URI_KEY); if (info != NULL) { @@ -1172,15 +1172,15 @@ mail_send (void) d(printf("send of %s still in progress\n", transport->url)); return; } - + d(printf("starting non-interactive send of '%s'\n", transport->url)); - + type = get_receive_type (transport->url); if (type == SEND_INVALID) { d(printf ("unsupported provider: '%s'\n", transport->url)); return; } - + info = g_malloc0 (sizeof (*info)); info->type = SEND_SEND; info->progress_bar = NULL; @@ -1192,11 +1192,11 @@ mail_send (void) info->data = data; info->state = SEND_ACTIVE; info->timeout_id = 0; - + d(printf("Adding new info %p\n", info)); - + g_hash_table_insert (data->active, SEND_URI_KEY, info); - + /* todo, store the folder in info? */ outbox_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX); mail_send_queue (outbox_folder, info->uri, diff --git a/mail/mail-session.c b/mail/mail-session.c index 8175c65ded..2f4d5c8021 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -109,7 +109,7 @@ static void class_init (MailSessionClass *mail_session_class) { CamelSessionClass *camel_session_class = CAMEL_SESSION_CLASS (mail_session_class); - + /* virtual method override */ camel_session_class->get_password = get_password; camel_session_class->forget_password = forget_password; @@ -125,7 +125,7 @@ static CamelType mail_session_get_type (void) { static CamelType mail_session_type = CAMEL_INVALID_TYPE; - + if (mail_session_type == CAMEL_INVALID_TYPE) { ms_parent_class = (CamelSessionClass *)camel_session_get_type(); mail_session_type = camel_type_register ( @@ -138,7 +138,7 @@ mail_session_get_type (void) (CamelObjectInitFunc) init, (CamelObjectFinalizeFunc) finalise); } - + return mail_session_type; } @@ -147,12 +147,12 @@ static char * make_key (CamelService *service, const char *item) { char *key; - + if (service) key = camel_url_to_string (service->url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); else key = g_strdup (item); - + return key; } @@ -206,7 +206,7 @@ get_password (CamelSession *session, CamelService *service, const char *domain, if (account) title = g_strdup_printf (_("Enter Password for %s"), account->name); else - title = g_strdup (_("Enter Password")); + title = g_strdup (_("Enter Password")); } if ((flags & CAMEL_SESSION_PASSWORD_STATIC) != 0) eflags = E_PASSWORDS_REMEMBER_NEVER; @@ -285,15 +285,15 @@ static void user_message_response (GtkDialog *dialog, int button, struct _user_message_msg *m) { gtk_widget_destroy ((GtkWidget *) dialog); - + message_dialog = NULL; - + /* if !allow_cancel, then we've already replied */ if (m->allow_cancel) { m->result = button == GTK_RESPONSE_OK; e_msgport_reply((EMsg *)m); } - + /* check for pendings */ if ((m = (struct _user_message_msg *)e_dlist_remhead(&message_list))) do_user_message((struct _mail_msg *)m); @@ -316,12 +316,12 @@ do_user_message (struct _mail_msg *mm) { struct _user_message_msg *m = (struct _user_message_msg *)mm; int type; - + if (!m->ismain && message_dialog != NULL) { e_dlist_addtail (&message_list, (EDListNode *)m); return; } - + switch (m->type) { case CAMEL_SESSION_ALERT_INFO: type = 0; @@ -338,10 +338,10 @@ do_user_message (struct _mail_msg *mm) if (m->allow_cancel) type += 3; - + message_dialog = (GtkDialog *)e_error_new(NULL, error_type[type], m->prompt, NULL); g_object_set ((GObject *) message_dialog, "allow_shrink", TRUE, "allow_grow", TRUE, NULL); - + /* We only need to wait for the result if we allow cancel otherwise show but send result back instantly */ if (m->allow_cancel) { if (m->ismain) { @@ -380,7 +380,7 @@ alert_user(CamelSession *session, CamelSessionAlertType type, const char *prompt return FALSE; if (cancel) - user_message_reply = e_msgport_new (); + user_message_reply = e_msgport_new (); m = mail_msg_new (&user_message_op, user_message_reply, sizeof (*m)); m->ismain = pthread_equal(pthread_self(), mail_gui_thread); m->type = type; @@ -421,7 +421,7 @@ main_play_sound (CamelFilterDriver *driver, char *filename, gpointer user_data) gnome_sound_play (filename); else gdk_beep (); - + g_free (filename); camel_object_unref (session); } @@ -430,9 +430,9 @@ static void session_play_sound (CamelFilterDriver *driver, const char *filename, gpointer user_data) { MailSession *ms = (MailSession *) session; - + camel_object_ref (session); - + mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_play_sound, driver, g_strdup (filename), user_data); } @@ -448,9 +448,9 @@ static void session_system_beep (CamelFilterDriver *driver, gpointer user_data) { MailSession *ms = (MailSession *) session; - + camel_object_ref (session); - + mail_async_event_emit (ms->async, MAIL_ASYNC_GUI, (MailAsyncFunc) main_system_beep, driver, user_data, NULL); } @@ -463,36 +463,36 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException char *user, *system; GConfClient *gconf; RuleContext *fc; - + gconf = mail_config_get_gconf_client (); - + user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ())); system = g_build_filename (EVOLUTION_PRIVDATADIR, "filtertypes.xml", NULL); fc = (RuleContext *) em_filter_context_new (); rule_context_load (fc, system, user); g_free (system); g_free (user); - + driver = camel_filter_driver_new (session); camel_filter_driver_set_folder_func (driver, get_folder, NULL); - + if (gconf_client_get_bool (gconf, "/apps/evolution/mail/filters/log", NULL)) { MailSession *ms = (MailSession *) session; - + if (ms->filter_logfile == NULL) { char *filename; - + filename = gconf_client_get_string (gconf, "/apps/evolution/mail/filters/logfile", NULL); if (filename) { ms->filter_logfile = g_fopen (filename, "a+"); g_free (filename); } } - + if (ms->filter_logfile) camel_filter_driver_set_logfile (driver, ms->filter_logfile); } - + camel_filter_driver_set_shell_func (driver, mail_execute_shell_command, NULL); camel_filter_driver_set_play_sound_func (driver, session_play_sound, NULL); camel_filter_driver_set_system_beep_func (driver, session_system_beep, NULL); @@ -505,29 +505,29 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException if (strcmp (type, FILTER_SOURCE_JUNKTEST) != 0) { GString *fsearch, *faction; - + fsearch = g_string_new (""); faction = g_string_new (""); - + if (!strcmp (type, FILTER_SOURCE_DEMAND)) type = FILTER_SOURCE_INCOMING; - + /* add the user-defined rules next */ while ((rule = rule_context_next_rule (fc, rule, type))) { g_string_truncate (fsearch, 0); g_string_truncate (faction, 0); - + filter_rule_build_code (rule, fsearch); em_filter_rule_build_action ((EMFilterRule *) rule, faction); camel_filter_driver_add_rule (driver, rule->name, fsearch->str, faction->str); } - + g_string_free (fsearch, TRUE); g_string_free (faction, TRUE); } - + g_object_unref (fc); - + return driver; } @@ -579,15 +579,15 @@ mail_session_get_password (const char *url_string) CamelURL *url; char *simple_url; char *passwd; - + url = camel_url_new (url_string, NULL); simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); camel_url_free (url); - + passwd = e_passwords_get_password ("Mail", simple_url); - + g_free (simple_url); - + return passwd; } @@ -597,13 +597,13 @@ mail_session_add_password (const char *url_string, { CamelURL *url; char *simple_url; - + url = camel_url_new (url_string, NULL); simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); camel_url_free (url); - + e_passwords_add_password (simple_url, passwd); - + g_free (simple_url); } @@ -612,13 +612,13 @@ mail_session_remember_password (const char *url_string) { CamelURL *url; char *simple_url; - + url = camel_url_new (url_string, NULL); simple_url = camel_url_to_string (url, CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS); camel_url_free (url); - + e_passwords_remember_password ("Mail", simple_url); - + g_free (simple_url); } @@ -649,14 +649,14 @@ mail_session_init (const char *base_directory) { char *camel_dir; GConfClient *gconf; - + if (camel_init (base_directory, TRUE) != 0) exit (0); camel_provider_init(); session = CAMEL_SESSION (camel_object_new (MAIL_SESSION_TYPE)); - + camel_dir = g_strdup_printf ("%s/mail", base_directory); camel_session_construct (session, camel_dir); @@ -670,7 +670,7 @@ mail_session_init (const char *base_directory) /* The shell will tell us to go online. */ camel_session_set_online ((CamelSession *) session, FALSE); - + g_free (camel_dir); } @@ -684,20 +684,20 @@ void mail_session_set_interactive (gboolean interactive) { MAIL_SESSION (session)->interactive = interactive; - + if (!interactive) { struct _user_message_msg *um; - + d(printf ("Gone non-interactive, checking for outstanding interactive tasks\n")); e_passwords_cancel(); - + /* flush/cancel pending user messages */ while ((um = (struct _user_message_msg *) e_dlist_remhead (&message_list))) { d(printf ("Flusing message request: %s\n", um->prompt)); e_msgport_reply((EMsg *) um); } - + /* and the current */ if (message_dialog) { d(printf("Destroying message dialogue\n")); @@ -717,7 +717,7 @@ void mail_session_flush_filter_log (void) { MailSession *ms = (MailSession *) session; - + if (ms->filter_logfile) fflush (ms->filter_logfile); } @@ -728,10 +728,10 @@ mail_session_add_junk_plugin (const char *plugin_name, CamelJunkPlugin *junk_plu MailSession *ms = (MailSession *) session; GConfClient *gconf; char *def_plugin; - + gconf = mail_config_get_gconf_client (); def_plugin = gconf_client_get_string (gconf, "/apps/evolution/mail/junk/default_plugin", NULL); - + ms->junk_plugins = g_list_append(ms->junk_plugins, junk_plugin); if (def_plugin && plugin_name) { if (!strcmp(def_plugin, plugin_name)) { @@ -747,6 +747,6 @@ mail_session_add_junk_plugin (const char *plugin_name, CamelJunkPlugin *junk_plu const GList * mail_session_get_junk_plugins (void) { - MailSession *ms = (MailSession *) session; + MailSession *ms = (MailSession *) session; return ms->junk_plugins; } diff --git a/mail/mail-session.h b/mail/mail-session.h index 36c175772b..bb444b1c6a 100644 --- a/mail/mail-session.h +++ b/mail/mail-session.h @@ -52,7 +52,7 @@ void mail_session_flush_filter_log (void); void mail_session_add_junk_plugin (const char *plugin_name, CamelJunkPlugin *junk_plugin); const GList * mail_session_get_junk_plugins (void); - + extern CamelSession *session; #ifdef __cplusplus diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c index d444591f1b..48e11041c0 100644 --- a/mail/mail-signature-editor.c +++ b/mail/mail-signature-editor.c @@ -45,7 +45,7 @@ #include "mail-signature-editor.h" #include "mail-config.h" -#define d(x) +#define d(x) #define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor:" GTKHTML_API_VERSION @@ -54,11 +54,11 @@ typedef struct _ESignatureEditor { GtkWidget *control; GtkWidget *name_entry; GtkWidget *info_frame; - + ESignature *sig; gboolean is_new; gboolean html; - + GNOME_GtkHTML_Editor_Engine engine; } ESignatureEditor; @@ -80,14 +80,14 @@ static void menu_file_save_error (BonoboUIComponent *uic, CORBA_Environment *ev) { char *err; - + /* errno is set if the rename() fails in menu_file_save_cb */ - + err = ev->_major != CORBA_NO_EXCEPTION ? bonobo_exception_get_text (ev) : g_strdup (g_strerror (errno)); - + e_error_run(NULL, "mail:no-save-signature", err, NULL); g_warning ("Exception while saving signature: %s", err); - + g_free (err); } @@ -97,20 +97,20 @@ get_text (Bonobo_PersistStream persist, const char *format, CORBA_Environment *e BonoboStream *stream; BonoboStreamMem *stream_mem; GByteArray *text; - + stream = bonobo_stream_mem_create (NULL, 0, FALSE, TRUE); Bonobo_PersistStream_save (persist, (Bonobo_Stream)bonobo_object_corba_objref (BONOBO_OBJECT (stream)), format, ev); - + if (ev->_major != CORBA_NO_EXCEPTION) return NULL; - + stream_mem = BONOBO_STREAM_MEM (stream); - + text = g_byte_array_new (); g_byte_array_append (text, (unsigned char *)stream_mem->buffer, stream_mem->pos); bonobo_object_unref (BONOBO_OBJECT (stream)); - + return text; } @@ -118,19 +118,19 @@ static ssize_t write_all (int fd, const char *buf, size_t n) { ssize_t w, nwritten = 0; - + do { do { w = write (fd, buf + nwritten, n - nwritten); } while (w == -1 && (errno == EINTR || errno == EAGAIN)); - + if (w > 0) nwritten += w; } while (nwritten < n && w != -1); - + if (w == -1) return -1; - + return nwritten; } @@ -189,20 +189,20 @@ menu_file_save_cb (BonoboUIComponent *uic, void *user_data, const char *path) editor->sig->html = editor->html; name = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (editor->name_entry)))); - + if (g_str_equal(name, "") ) { e_error_run ((GtkWindow *)editor->win, "mail:blank-signature", NULL); - return; + return; } - + if ( (signature = (ESignature *)e_signature_list_find (mail_config_get_signatures (), E_SIGNATURE_FIND_NAME, name)) && !g_str_equal(signature->uid, editor->sig->uid) ) { e_error_run ((GtkWindow *)editor->win, "mail:signature-already-exists", name, NULL); - return; + return; } - + if (editor->sig->name) g_free (editor->sig->name); - + editor->sig->name = name; /* if the signature isn't already saved in the config, save it there now... */ @@ -249,17 +249,17 @@ do_exit (ESignatureEditor *editor) button = e_error_run((GtkWindow *)editor->win, "mail:ask-signature-changed", NULL); exit_dialog_cb (button, editor); - } else + } else destroy_editor (editor); CORBA_exception_free (&ev); } -static int +static int delete_event_cb (GtkWidget *w, GdkEvent *event, ESignatureEditor *editor) { do_exit (editor); - + return TRUE; } @@ -267,7 +267,7 @@ static void menu_file_close_cb (BonoboUIComponent *uic, gpointer data, const char *path) { ESignatureEditor *editor; - + editor = E_SIGNATURE_EDITOR (data); do_exit (editor); } @@ -276,9 +276,9 @@ static void menu_file_save_close_cb (BonoboUIComponent *uic, gpointer data, const char *path) { ESignatureEditor *editor; - + editor = E_SIGNATURE_EDITOR (data); - + menu_file_save_cb (uic, editor, path); } @@ -287,7 +287,7 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("FileSave", menu_file_save_cb), BONOBO_UI_VERB ("FileClose", menu_file_close_cb), BONOBO_UI_VERB ("FileSaveClose", menu_file_save_close_cb), - + BONOBO_UI_VERB_END }; @@ -295,10 +295,10 @@ static void load_signature (ESignatureEditor *editor) { CORBA_Environment ev; - + if (editor->html) { Bonobo_PersistFile pfile_iface; - + CORBA_exception_init (&ev); pfile_iface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)),"IDL:Bonobo/PersistFile:1.0", &ev); Bonobo_PersistFile_load (pfile_iface, editor->sig->filename, &ev); @@ -307,34 +307,34 @@ load_signature (ESignatureEditor *editor) Bonobo_PersistStream pstream_iface; BonoboStream *stream; char *data, *html; - + data = e_msg_composer_get_sig_file_content (editor->sig->filename, FALSE); html = g_strdup_printf ("<PRE>\n%s", data); g_free (data); - + CORBA_exception_init (&ev); pstream_iface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)), "IDL:Bonobo/PersistStream:1.0",&ev); stream = bonobo_stream_mem_create (html, strlen (html), TRUE, FALSE); - + if (stream == NULL) { g_warning ("Couldn't create memory stream\n"); } else { BonoboObject *stream_object; Bonobo_Stream corba_stream; - + stream_object = BONOBO_OBJECT (stream); corba_stream = bonobo_object_corba_objref (stream_object); Bonobo_PersistStream_load (pstream_iface, corba_stream, "text/html", &ev); } - + Bonobo_Unknown_unref (pstream_iface, &ev); CORBA_Object_release (pstream_iface, &ev); CORBA_exception_free (&ev); bonobo_object_unref (BONOBO_OBJECT (stream)); - + g_free (html); } } @@ -354,10 +354,10 @@ format_html_cb (BonoboUIComponent *component, { ESignatureEditor *editor = (ESignatureEditor *) data; - + if (type != Bonobo_UIComponent_STATE_CHANGED) return; - + editor->html = atoi (state); bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", TC_CORBA_boolean, editor->html, NULL); } @@ -371,12 +371,12 @@ mail_signature_editor (ESignature *sig, GtkWindow *parent, gboolean is_new) BonoboUIContainer *container; GtkWidget *vbox, *hbox, *label, *frame, *vbox1; char *xmlfile; - + if (!sig->filename || !*sig->filename) return; - + editor = g_new0 (ESignatureEditor, 1); - + editor->sig = sig; editor->html = sig->html; editor->is_new = is_new; @@ -389,9 +389,9 @@ mail_signature_editor (ESignature *sig, GtkWindow *parent, gboolean is_new) g_object_set (editor->win, "allow_shrink", FALSE, "allow_grow", TRUE, NULL); g_object_set_data (G_OBJECT(editor->win), "name-changed", GINT_TO_POINTER(0)); - + container = bonobo_window_get_ui_container (BONOBO_WINDOW(editor->win)); - + component = bonobo_ui_component_new_default (); bonobo_ui_component_set_container (component, bonobo_object_corba_objref (BONOBO_OBJECT (container)), NULL); bonobo_ui_component_add_verb_list_with_data (component, verbs, editor); @@ -406,24 +406,24 @@ mail_signature_editor (ESignature *sig, GtkWindow *parent, gboolean is_new) editor->control = bonobo_widget_new_control (GNOME_GTKHTML_EDITOR_CONTROL_ID, bonobo_ui_component_get_container (component)); - + if (editor->control == NULL) { g_warning ("Cannot get '" GNOME_GTKHTML_EDITOR_CONTROL_ID "'."); - + destroy_editor (editor); return; } - + editor->engine = (GNOME_GtkHTML_Editor_Engine) Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev); CORBA_exception_free(&ev); load_signature (editor); - + bonobo_ui_component_set_prop (component, "/commands/FormatHtml", "state", editor->html ? "1" : "0", NULL); bonobo_ui_component_add_listener (component, "FormatHtml", format_html_cb, editor); - + g_signal_connect (editor->win, "delete_event", G_CALLBACK (delete_event_cb), editor); - + vbox = gtk_vbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 4); vbox1 = gtk_vbox_new (FALSE, 3); @@ -444,12 +444,12 @@ mail_signature_editor (ESignature *sig, GtkWindow *parent, gboolean is_new) gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_widget_show_all (vbox); gtk_box_pack_start_defaults (GTK_BOX (vbox), editor->control); - + bonobo_window_set_contents (BONOBO_WINDOW (editor->win), vbox); bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", TC_CORBA_boolean, editor->html, NULL); gtk_widget_show (GTK_WIDGET (editor->win)); gtk_widget_show (GTK_WIDGET (editor->control)); - + if (is_new) gtk_widget_grab_focus (editor->name_entry); else { diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 2cd2ebbfba..59bbf7936d 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -1,14 +1,14 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: +/* + * Authors: * Dan Winship <danw@ximian.com> * Peter Williams <peterw@ximian.com> * Jeffrey Stedfast <fejj@ximian.com> * * Copyright 2000 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, @@ -66,14 +66,14 @@ mail_tool_get_inbox (const gchar *url, CamelException *ex) { CamelStore *store; CamelFolder *folder; - + store = camel_session_get_store (session, url, ex); if (!store) return NULL; - + folder = camel_store_get_inbox (store, ex); camel_object_unref (store); - + return folder; } @@ -82,22 +82,22 @@ mail_tool_get_trash (const gchar *url, int connect, CamelException *ex) { CamelStore *store; CamelFolder *trash; - + if (connect) store = camel_session_get_store (session, url, ex); else store = (CamelStore *) camel_session_get_service (session, url, CAMEL_PROVIDER_STORE, ex); - + if (!store) return NULL; - + if (connect || ((CamelService *) store)->status == CAMEL_SERVICE_CONNECTED) trash = camel_store_get_trash (store, ex); else trash = NULL; - + camel_object_unref (store); - + return trash; } @@ -126,7 +126,7 @@ mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex) full = g_strdup_printf("%s/movemail.%s", path, safe_uri); g_free(path); g_free(safe_uri); - + return full; } @@ -152,7 +152,7 @@ mail_tool_do_movemail (const char *source_url, CamelException *ex) camel_url_free(uri); return NULL; } - + /* Set up our destination. */ dest_path = mail_tool_get_local_movemail_path ((unsigned char *)source_url, ex); if (dest_path == NULL) @@ -167,12 +167,12 @@ mail_tool_do_movemail (const char *source_url, CamelException *ex) g_free (dest_path); return NULL; } - + if (camel_exception_is_set (ex)) { g_free (dest_path); return NULL; } - + return dest_path; #else /* Unclear yet whether camel-movemail etc makes any sense on @@ -189,9 +189,9 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg) const char *subject; char *fwd_subj; const int max_subject_length = 1024; - + subject = camel_mime_message_get_subject(msg); - + if (subject && *subject) { /* Truncate insanely long subjects */ if (strlen (subject) < max_subject_length) { @@ -208,7 +208,7 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg) } else { const CamelInternetAddress *from; char *fromstr; - + from = camel_mime_message_get_from (msg); if (from) { fromstr = camel_address_format (CAMEL_ADDRESS (from)); @@ -217,7 +217,7 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg) } else fwd_subj = g_strdup ("[Fwd: No Subject]"); } - + return fwd_subj; } @@ -250,20 +250,20 @@ mail_tool_make_message_attachment (CamelMimeMessage *message) const char *subject; struct _camel_header_raw *xev; char *desc; - + subject = camel_mime_message_get_subject (message); if (subject) desc = g_strdup_printf (_("Forwarded message - %s"), subject); else desc = g_strdup (_("Forwarded message")); - + /* rip off the X-Evolution headers */ xev = mail_tool_remove_xevolution_headers (message); camel_header_raw_clear(&xev); - + /* remove Bcc headers */ camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc"); - + part = camel_mime_part_new (); camel_mime_part_set_disposition (part, "inline"); camel_mime_part_set_description (part, desc); @@ -271,7 +271,7 @@ mail_tool_make_message_attachment (CamelMimeMessage *message) CAMEL_DATA_WRAPPER (message)); camel_mime_part_set_content_type (part, "message/rfc822"); g_free (desc); - + return part; } @@ -300,7 +300,7 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) } uri = curi; } - + url = camel_url_new (uri + offset, ex); if (!url) { g_free(curi); @@ -321,7 +321,7 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) else name = ""; } - + if (offset) { if (offset == 7) folder = camel_store_get_trash (store, ex); @@ -331,13 +331,13 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) folder = camel_store_get_folder (store, name, flags, ex); camel_object_unref (store); } - + if (folder) mail_note_folder (folder); - + camel_url_free (url); g_free(curi); - + return folder; } @@ -356,29 +356,29 @@ mail_tools_x_evolution_message_parse (char *in, unsigned int inlen, GPtrArray ** /* format: "uri\0uid1\0uid2\0uid3\0...\0uidn" */ char *inptr, *inend; CamelFolder *folder; - + if (in == NULL) return NULL; - + folder = mail_tool_uri_to_folder (in, 0, NULL); - + if (!folder) return NULL; - + /* split the uids */ inend = in + inlen; inptr = in + strlen (in) + 1; *uids = g_ptr_array_new (); while (inptr < inend) { char *start = inptr; - + while (inptr < inend && *inptr) inptr++; - + g_ptr_array_add (*uids, g_strndup (start, inptr - start)); inptr++; } - + return folder; } diff --git a/mail/mail-tools.h b/mail/mail-tools.h index 6ef6001798..0d2354dc29 100644 --- a/mail/mail-tools.h +++ b/mail/mail-tools.h @@ -1,12 +1,12 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Author : + * + * Author : * Peter Williams <peterw@ximian.com> * * Copyright 2000 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, diff --git a/mail/mail-types.h b/mail/mail-types.h index 38b18abd87..d80b21276d 100644 --- a/mail/mail-types.h +++ b/mail/mail-types.h @@ -1,10 +1,10 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * Copyright 2000 Ximian, Inc. (www.ximian.com) * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 35edafba75..9f4b8e2d94 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -179,14 +179,14 @@ vfolder_setup(CamelFolder *folder, const char *query, GList *sources_uri, GList { struct _setup_msg *m; int id; - + m = mail_msg_new(&vfolder_setup_op, NULL, sizeof (*m)); m->folder = folder; camel_object_ref(folder); m->query = g_strdup(query); m->sources_uri = sources_uri; m->sources_folder = sources_folder; - + id = m->msg.seq; e_thread_put(mail_thread_queued_slow, (EMsg *)m); @@ -224,7 +224,7 @@ vfolder_adduri_desc(struct _mail_msg *mm, int done) } else { char *uid; const EAccount *account; - + if (url->user == NULL) uid = g_strdup(url->host); else @@ -316,12 +316,12 @@ vfolder_adduri(const char *uri, GList *folders, int remove) { struct _adduri_msg *m; int id; - + m = mail_msg_new(&vfolder_adduri_op, NULL, sizeof (*m)); m->folders = folders; m->uri = g_strdup(uri); m->remove = remove; - + id = m->msg.seq; e_thread_put(mail_thread_queued_slow, (EMsg *)m); @@ -349,16 +349,16 @@ uri_is_ignore(CamelStore *store, const char *uri) EAccount *account; EIterator *iter; int found = FALSE; - + d(printf("checking '%s' against:\n %s\n %s\n %s\n", uri, mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_OUTBOX), mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT), mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS))); - + found = camel_store_folder_uri_equal(store, mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_OUTBOX), uri) || camel_store_folder_uri_equal(store, mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_SENT), uri) || camel_store_folder_uri_equal(store, mail_component_get_folder_uri(NULL, MAIL_COMPONENT_FOLDER_DRAFTS), uri); - + if (found) return found; @@ -385,12 +385,12 @@ uri_is_ignore(CamelStore *store, const char *uri) if (found) break; - + e_iterator_next (iter); } - + g_object_unref (iter); - + return found; } @@ -454,7 +454,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove) LOCK(); /* d(printf("%s uri to check: %s\n", remove?"Removing":"Adding", uri)); */ - + /* maintain the source folders lists for changed rules later on */ if (CAMEL_IS_VEE_STORE(store)) { is_ignore = TRUE; @@ -484,7 +484,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove) rule = NULL; while ((rule = rule_context_next_rule((RuleContext *)context, rule, NULL))) { int found = FALSE; - + if (!rule->name) { d(printf("invalid rule (%p): rule->name is set to NULL\n", rule)); continue; @@ -496,7 +496,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove) || (((EMVFolderRule *)rule)->with == EM_VFOLDER_RULE_WITH_REMOTE_ACTIVE && remote) || (((EMVFolderRule *)rule)->with == EM_VFOLDER_RULE_WITH_LOCAL_REMOTE_ACTIVE))) found = TRUE; - + source = NULL; while (!found && (source = em_vfolder_rule_next_source((EMVFolderRule *)rule, source))) { char *csource; @@ -516,9 +516,9 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove) folders = g_list_prepend(folders, vf); } } - + UNLOCK(); - + if (folders != NULL) vfolder_adduri(curi, folders, remove); @@ -542,13 +542,13 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi) uri = em_uri_from_camel(curi); d(printf ("Deleting uri to check: %s\n", uri)); - + g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread)); - + changed = g_string_new (""); - + LOCK(); - + /* see if any rules directly reference this removed uri */ rule = NULL; while ((rule = rule_context_next_rule ((RuleContext *) context, rule, NULL))) { @@ -590,23 +590,23 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi) g_free(link->data); source_folders_local = g_list_remove_link(source_folders_local, link); } - + UNLOCK(); - + if (changed->str[0]) { GtkWidget *dialog; char *user; - + dialog = e_error_new(NULL, "mail:vfolder-updated", changed->str, uri, NULL); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); gtk_widget_show (dialog); - + user = g_strdup_printf ("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save ((RuleContext *) context, user); g_free (user); } - + g_string_free (changed, TRUE); g_free(uri); @@ -649,7 +649,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto) if (!vf) { g_warning ("vf is NULL for %s\n", rule->name); continue; - } + } g_signal_handlers_disconnect_matched(rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0, 0, NULL, rule_changed, vf); em_vfolder_rule_remove_source((EMVFolderRule *)rule, source); @@ -796,14 +796,14 @@ static void context_rule_removed(RuleContext *ctx, FilterRule *rule) d(printf("rule removed; %s\n", rule->name)); /* TODO: remove from folder info cache? */ - + /* FIXME: is this even necessary? if we remove the folder from * the CamelStore, the tree should pick it up auto-magically * because it listens to CamelStore events... */ path = g_strdup_printf("/%s", rule->name); mail_component_remove_folder (mail_component_peek (), vfolder_store, path); g_free(path); - + LOCK(); if (g_hash_table_lookup_extended (vfolder_hash, rule->name, &key, &folder)) { g_hash_table_remove (vfolder_hash, key); @@ -851,7 +851,7 @@ store_folder_deleted(CamelObject *o, void *event_data, void *data) rule_context_remove_rule((RuleContext *)context, rule); g_object_unref(rule); g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); - + user = g_strdup_printf("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); rule_context_save((RuleContext *)context, user); g_free(user); @@ -870,7 +870,7 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) char *user; gpointer key, folder; - + /* This should be more-or-less thread-safe */ d(printf("Folder renamed to '%s' from '%s'\n", info->new->full_name, info->old_base)); @@ -929,10 +929,10 @@ vfolder_load_storage(void) (CamelObjectEventHookFunc)store_folder_deleted, NULL); camel_object_hook_event(vfolder_store, "folder_renamed", (CamelObjectEventHookFunc)store_folder_renamed, NULL); - + d(printf("got store '%s' = %p\n", storeuri, vfolder_store)); mail_component_load_store_by_uri (mail_component_peek (), storeuri, _("Search Folders")); - + /* load our rules */ user = g_strdup_printf ("%s/mail/vfolders.xml", mail_component_peek_base_directory (mail_component_peek ())); context = em_vfolder_context_new (); @@ -944,7 +944,7 @@ vfolder_load_storage(void) } g_free (xmlfile); g_free (user); - + g_signal_connect(context, "rule_added", G_CALLBACK(context_rule_added), context); g_signal_connect(context, "rule_removed", G_CALLBACK(context_rule_removed), context); @@ -1002,11 +1002,11 @@ vfolder_edit (void) gdk_window_raise (GTK_WIDGET (vfolder_editor)->window); return; } - + vfolder_editor = GTK_WIDGET (em_vfolder_editor_new (context)); gtk_window_set_title (GTK_WINDOW (vfolder_editor), _("Search Folders")); g_signal_connect(vfolder_editor, "response", G_CALLBACK(em_vfolder_editor_response), NULL); - + gtk_widget_show (vfolder_editor); } @@ -1164,7 +1164,7 @@ vfolder_gui_add_from_address(CamelInternetAddress *addr, int flags, const char * EMVFolderRule *rule; g_return_if_fail (addr != NULL); - + rule = (EMVFolderRule*)em_vfolder_rule_from_address(context, addr, flags, source); vfolder_gui_add_rule(rule); } @@ -1173,10 +1173,10 @@ static void vfolder_foreach_cb (gpointer key, gpointer data, gpointer user_data) { CamelFolder *folder = CAMEL_FOLDER (data); - + if (folder) camel_object_unref(folder); - + g_free (key); } @@ -1195,7 +1195,7 @@ mail_vfolder_shutdown (void) camel_object_unref (vfolder_store); vfolder_store = NULL; } - + if (context) { g_object_unref(context); context = NULL; diff --git a/mail/message-list.c b/mail/message-list.c index ea627c952a..0936938d1a 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -97,7 +97,7 @@ #define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0) #endif -#define d(x) +#define d(x) #define t(x) struct _MLSelection { @@ -248,14 +248,14 @@ e_mail_address_new (const char *address) CamelInternetAddress *cia; EMailAddress *new; const char *name = NULL, *addr = NULL; - + cia = camel_internet_address_new (); if (camel_address_unformat (CAMEL_ADDRESS (cia), address) == -1) { camel_object_unref (cia); return NULL; } camel_internet_address_get (cia, 0, &name, &addr); - + new = g_new (EMailAddress, 1); new->address = g_strdup (addr); if (name && *name) { @@ -263,9 +263,9 @@ e_mail_address_new (const char *address) } else { new->wname = NULL; } - + camel_object_unref (cia); - + return new; } @@ -273,7 +273,7 @@ static void e_mail_address_free (EMailAddress *addr) { g_return_if_fail (addr != NULL); - + g_free (addr->address); if (addr->wname) e_name_western_free (addr->wname); @@ -289,55 +289,55 @@ e_mail_address_compare (gconstpointer address1, gconstpointer address2) const EMailAddress *addr1 = address1; const EMailAddress *addr2 = address2; int retval; - + g_return_val_if_fail (addr1 != NULL, 1); g_return_val_if_fail (addr2 != NULL, -1); - + if (!addr1->wname && !addr2->wname) { /* have to compare addresses, one or both don't have names */ g_return_val_if_fail (addr1->address != NULL, 1); g_return_val_if_fail (addr2->address != NULL, -1); - + return strcmp (addr1->address, addr2->address); } - + if (!addr1->wname) return -1; if (!addr2->wname) return 1; - + if (!addr1->wname->last && !addr2->wname->last) { /* neither has a last name - default to address? */ /* FIXME: what do we compare next? */ g_return_val_if_fail (addr1->address != NULL, 1); g_return_val_if_fail (addr2->address != NULL, -1); - + return strcmp (addr1->address, addr2->address); } - + if (!addr1->wname->last) return -1; if (!addr2->wname->last) return 1; - + retval = strcmp (addr1->wname->last, addr2->wname->last); if (retval) return retval; - + /* last names are identical - compare first names */ - + if (!addr1->wname->first && !addr2->wname->first) return strcmp (addr1->address, addr2->address); - + if (!addr1->wname->first) return -1; if (!addr2->wname->first) return 1; - + retval = strcmp (addr1->wname->first, addr2->wname->first); if (retval) return retval; - + return strcmp (addr1->address, addr2->address); } #endif /* SMART_ADDRESS_COMPARE */ @@ -352,10 +352,10 @@ address_compare (gconstpointer address1, gconstpointer address2) EMailAddress *addr1, *addr2; #endif /* SMART_ADDRESS_COMPARE */ int retval; - + g_return_val_if_fail (address1 != NULL, 1); g_return_val_if_fail (address2 != NULL, -1); - + #ifdef SMART_ADDRESS_COMPARE addr1 = e_mail_address_new (address1); addr2 = e_mail_address_new (address2); @@ -365,7 +365,7 @@ address_compare (gconstpointer address1, gconstpointer address2) #else retval = strcmp ((char *) address1, (char *) address2); #endif /* SMART_ADDRESS_COMPARE */ - + return retval; } @@ -373,7 +373,7 @@ static char * filter_size (gint size) { gfloat fsize; - + if (size < 1024) { return g_strdup_printf ("%d", size); } else { @@ -392,12 +392,12 @@ static const char * get_message_uid (MessageList *message_list, ETreePath node) { CamelMessageInfo *info; - + g_return_val_if_fail (node != NULL, NULL); info = e_tree_memory_node_get_data (E_TREE_MEMORY (message_list->model), node); /* correct me if I'm wrong, but this should never be NULL, should it? */ g_return_val_if_fail (info != NULL, NULL); - + return camel_message_info_uid (info); } @@ -408,11 +408,11 @@ static CamelMessageInfo * get_message_info (MessageList *message_list, ETreePath node) { CamelMessageInfo *info; - + g_return_val_if_fail (node != NULL, NULL); info = e_tree_memory_node_get_data (E_TREE_MEMORY (message_list->model), node); g_return_val_if_fail (info != NULL, NULL); - + return info; } @@ -423,7 +423,7 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int co char *normalised; EPoolv *poolv; int index; - + switch (col) { case COL_SUBJECT_NORM: string = camel_message_info_subject (info); @@ -442,11 +442,11 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int co index = NORMALISED_LAST; g_warning ("Should not be reached\n"); } - + /* slight optimisation */ if (string == NULL || string[0] == '\0') return ""; - + poolv = g_hash_table_lookup (message_list->normalised_hash, camel_message_info_uid (info)); if (poolv == NULL) { poolv = e_poolv_new (NORMALISED_LAST); @@ -456,29 +456,29 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int co if (*str) return str; } - + if (col == COL_SUBJECT_NORM) { const unsigned char *subject; - + subject = (const unsigned char *) string; while (!g_ascii_strncasecmp ((char *)subject, "Re:", 3)) { subject += 3; - + /* jump over any spaces */ while (*subject && isspace ((int) *subject)) subject++; } - + /* jump over any spaces */ while (*subject && isspace ((int) *subject)) subject++; - + string = (const char *) subject; } - + normalised = g_utf8_collate_key (string, -1); e_poolv_set (poolv, index, normalised, TRUE); - + return e_poolv_get (poolv, index); } @@ -613,14 +613,14 @@ message_list_select(MessageList *ml, MessageListSelectDirection direction, guint /** * message_list_can_select: - * @ml: - * @direction: - * @flags: - * @mask: - * + * @ml: + * @direction: + * @flags: + * @mask: + * * Returns true if the selection specified is possible with the current view. - * - * Return value: + * + * Return value: **/ gboolean message_list_can_select(MessageList *ml, MessageListSelectDirection direction, guint32 flags, guint32 mask) @@ -647,7 +647,7 @@ message_list_select_uid (MessageList *message_list, const char *uid) g_free(message_list->pending_select_uid); message_list->pending_select_uid = g_strdup(uid); } - + node = g_hash_table_lookup (message_list->uid_nodemap, uid); if (node) { /* This will emit a changed signal that we'll pick up */ @@ -696,9 +696,9 @@ void message_list_select_all (MessageList *message_list) { ESelectionModel *etsm; - + etsm = e_tree_get_selection_model (message_list->tree); - + e_selection_model_select_all (etsm); } @@ -712,7 +712,7 @@ static gboolean select_node (ETreeModel *model, ETreePath path, gpointer user_data) { thread_select_info_t *tsi = (thread_select_info_t *) user_data; - + g_ptr_array_add (tsi->paths, path); return FALSE; /*not done yet*/ } @@ -723,24 +723,24 @@ thread_select_foreach (ETreePath path, gpointer user_data) thread_select_info_t *tsi = (thread_select_info_t *) user_data; ETreeModel *model = tsi->ml->model; ETreePath node; - + /* @path part of the initial selection. If it has children, * we select them as well. If it doesn't, we select its siblings and * their children (ie, the current node must be inside the thread * that the user wants to mark. */ - + if (e_tree_model_node_get_first_child (model, path)) { node = path; } else { node = e_tree_model_node_get_parent (model, path); - + /* Let's make an exception: if no parent, then we're about * to mark the whole tree. No. */ - if (e_tree_model_node_is_root (model, node)) + if (e_tree_model_node_is_root (model, node)) node = path; } - + e_tree_model_node_traverse (model, node, select_node, tsi); } @@ -755,12 +755,12 @@ message_list_select_thread (MessageList *message_list) { ETreeSelectionModel *etsm; thread_select_info_t tsi; - + tsi.ml = message_list; tsi.paths = g_ptr_array_new (); - + etsm = (ETreeSelectionModel *) e_tree_get_selection_model (message_list->tree); - + e_tree_selected_path_foreach (message_list->tree, thread_select_foreach, &tsi); e_tree_selection_model_select_paths(etsm, tsi.paths); g_ptr_array_free (tsi.paths, TRUE); @@ -776,9 +776,9 @@ void message_list_invert_selection (MessageList *message_list) { ESelectionModel *etsm; - + etsm = e_tree_get_selection_model (message_list->tree); - + e_selection_model_invert_selection (etsm); } @@ -789,7 +789,7 @@ message_list_copy(MessageList *ml, gboolean cut) GPtrArray *uids; clear_selection(ml, &p->clipboard); - + uids = message_list_get_selected(ml); if (uids->len > 0) { @@ -903,14 +903,14 @@ ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data) case COL_FOLLOWUP_FLAG_STATUS: case COL_FOLLOWUP_DUE_BY: return (void *) value; - + case COL_FROM: case COL_SUBJECT: case COL_TO: case COL_SENDER: case COL_RECIPIENTS: case COL_MIXED_SENDER: - case COL_MIXED_RECIPIENTS: + case COL_MIXED_RECIPIENTS: case COL_FOLLOWUP_FLAG: case COL_LOCATION: return g_strdup (value); @@ -936,7 +936,7 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data) case COL_FOLLOWUP_FLAG_STATUS: case COL_FOLLOWUP_DUE_BY: break; - + case COL_FROM: case COL_SUBJECT: case COL_TO: @@ -945,7 +945,7 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data) case COL_SENDER: case COL_RECIPIENTS: case COL_MIXED_SENDER: - case COL_MIXED_RECIPIENTS: + case COL_MIXED_RECIPIENTS: g_free (value); break; default: @@ -969,7 +969,7 @@ ml_initialize_value (ETreeModel *etm, int col, void *data) case COL_FOLLOWUP_FLAG_STATUS: case COL_FOLLOWUP_DUE_BY: return NULL; - + case COL_FROM: case COL_SUBJECT: case COL_TO: @@ -978,7 +978,7 @@ ml_initialize_value (ETreeModel *etm, int col, void *data) case COL_SENDER: case COL_RECIPIENTS: case COL_MIXED_SENDER: - case COL_MIXED_RECIPIENTS: + case COL_MIXED_RECIPIENTS: return g_strdup (""); default: g_warning ("This shouldn't be reached\n"); @@ -1003,7 +1003,7 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data) case COL_FOLLOWUP_FLAG_STATUS: case COL_FOLLOWUP_DUE_BY: return value == NULL; - + case COL_FROM: case COL_SUBJECT: case COL_TO: @@ -1012,7 +1012,7 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data) case COL_SENDER: case COL_RECIPIENTS: case COL_MIXED_SENDER: - case COL_MIXED_RECIPIENTS: + case COL_MIXED_RECIPIENTS: return !(value && *(char *)value); default: g_warning ("This shouldn't be reached\n"); @@ -1043,35 +1043,35 @@ static char * ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data) { unsigned int i; - + switch (col){ case COL_MESSAGE_STATUS: i = GPOINTER_TO_UINT(value); if (i > 4) return g_strdup (""); return g_strdup (_(status_map[i])); - + case COL_SCORE: i = GPOINTER_TO_UINT(value) + 3; if (i > 6) i = 3; return g_strdup (_(score_map[i])); - + case COL_ATTACHMENT: case COL_FLAGGED: case COL_DELETED: case COL_UNREAD: case COL_FOLLOWUP_FLAG_STATUS: return g_strdup_printf ("%u", GPOINTER_TO_UINT(value)); - + case COL_SENT: case COL_RECEIVED: case COL_FOLLOWUP_DUE_BY: return filter_date (GPOINTER_TO_INT (value)); - + case COL_SIZE: return filter_size (GPOINTER_TO_INT (value)); - + case COL_FROM: case COL_SUBJECT: case COL_TO: @@ -1080,7 +1080,7 @@ ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data) case COL_SENDER: case COL_RECIPIENTS: case COL_MIXED_SENDER: - case COL_MIXED_RECIPIENTS: + case COL_MIXED_RECIPIENTS: return g_strdup (value); default: g_warning ("This shouldn't be reached\n"); @@ -1101,14 +1101,14 @@ subtree_unread(MessageList *ml, ETreePath node) { CamelMessageInfo *info; ETreePath child; - + while (node) { info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); g_return_val_if_fail (info != NULL, FALSE); - + if (!(camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN)) return TRUE; - + if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node))) if (subtree_unread(ml, child)) return TRUE; @@ -1123,15 +1123,15 @@ subtree_size(MessageList *ml, ETreePath node) CamelMessageInfo *info; int size = 0; ETreePath child; - + while (node) { info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); g_return_val_if_fail (info != NULL, 0); - + size += camel_message_info_size(info); if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node))) size += subtree_size(ml, child); - + node = e_tree_model_node_get_next (ml->model, node); } return size; @@ -1143,28 +1143,28 @@ subtree_latest(MessageList *ml, ETreePath node, int sent) CamelMessageInfo *info; time_t latest = 0, date; ETreePath *child; - + while (node) { info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node); g_return_val_if_fail (info != NULL, 0); - + if (sent) date = camel_message_info_date_sent(info); else date = camel_message_info_date_received(info); - + if (latest == 0 || date > latest) latest = date; - + if ((child = e_tree_model_node_get_first_child (ml->model, node))) { date = subtree_latest(ml, child, sent); if (latest == 0 || (date != 0 && date > latest)) latest = date; } - + node = e_tree_model_node_get_next (ml->model, node); } - + return latest; } @@ -1180,7 +1180,7 @@ sanitize_recipients (const gchar *string) if (!string || !*string) return ""; - + gstring = g_string_new (""); for (p = string; *p; p = g_utf8_next_char (p)) { @@ -1225,11 +1225,11 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) if (e_tree_model_node_is_root (etm, path)) return NULL; - + /* retrieve the message information array */ msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path); g_return_val_if_fail (msg_info != NULL, NULL); - + switch (col){ case COL_MESSAGE_STATUS: flags = camel_message_info_flags(msg_info); @@ -1244,16 +1244,16 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) case COL_SCORE: { const char *tag; int score = 0; - + tag = camel_message_info_user_tag(msg_info, "score"); if (tag) score = atoi (tag); - + return GINT_TO_POINTER (score); } case COL_FOLLOWUP_FLAG_STATUS: { const char *tag, *cmp; - + /* FIXME: this all should be methods off of message-tag-followup class, FIXME: the tag names should be namespaced :( */ tag = camel_message_info_user_tag(msg_info, "follow-up"); @@ -1269,7 +1269,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) case COL_FOLLOWUP_DUE_BY: { const char *tag; time_t due_by; - + tag = camel_message_info_user_tag(msg_info, "due-by"); if (tag && *tag) { due_by = camel_header_decode_date (tag, NULL); @@ -1300,7 +1300,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) if (child && !e_tree_node_is_expanded(message_list->tree, path)) { return GINT_TO_POINTER (subtree_latest (message_list, child, 1)); } - + return GINT_TO_POINTER (camel_message_info_date_sent(msg_info)); } case COL_RECEIVED: { @@ -1311,7 +1311,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) return GINT_TO_POINTER (subtree_latest (message_list, child, 0)); } return GINT_TO_POINTER (camel_message_info_date_received(msg_info)); - } + } case COL_TO: str = camel_message_info_to (msg_info); return (void *)(str ? str : ""); @@ -1330,12 +1330,12 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) && (flags & CAMEL_MESSAGE_SEEN)) { return GINT_TO_POINTER (subtree_unread (message_list, child)); } - + return GINT_TO_POINTER (!(flags & CAMEL_MESSAGE_SEEN)); } case COL_COLOUR: { const char *colour, *due_by, *completed, *label; - + /* Priority: colour tag; label tag; important flag; due-by tag */ /* This is astonisngly poorly written code */ @@ -1359,7 +1359,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) } else if ((due_by && *due_by) && !(completed && *completed)) { time_t now = time (NULL); time_t target_date; - + target_date = camel_header_decode_date (due_by, NULL); if (now >= target_date) colour = "#A7453E"; @@ -1374,42 +1374,42 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) EAccount *account; char *location = NULL; char *euri, *url; - + if (CAMEL_IS_VEE_FOLDER(message_list->folder)) { folder = camel_vee_folder_get_location((CamelVeeFolder *)message_list->folder, (CamelVeeMessageInfo *)msg_info, NULL); } else { folder = message_list->folder; } - + url = mail_tools_folder_to_url (folder); euri = em_uri_from_camel(url); - + account = mail_config_get_account_by_source_url (url); - + if (account) { - curl = camel_url_new (url, &ex); + curl = camel_url_new (url, &ex); location = g_strconcat (account->name, ":", curl->path, NULL); } else { /* Local account */ euri = em_uri_from_camel(url); - curl = camel_url_new (euri, &ex); - if (curl->host && !strcmp(curl->host, "local") && curl->user && !strcmp(curl->user, "local")) + curl = camel_url_new (euri, &ex); + if (curl->host && !strcmp(curl->host, "local") && curl->user && !strcmp(curl->user, "local")) location = g_strconcat ("On This Computer", ":",curl->path, NULL); } - + camel_exception_clear (&ex); g_free (url); g_free (euri); - + return location; } - case COL_MIXED_RECIPIENTS: + case COL_MIXED_RECIPIENTS: case COL_RECIPIENTS:{ str = camel_message_info_to (msg_info); - + return sanitize_recipients(str); } - case COL_MIXED_SENDER: + case COL_MIXED_SENDER: case COL_SENDER:{ char **sender_name = NULL; str = camel_message_info_from (msg_info); @@ -1418,7 +1418,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data) return (void *)(*sender_name); } else - return (void *)(""); + return (void *)(""); } default: g_warning ("This shouldn't be reached\n"); @@ -1464,7 +1464,7 @@ ml_tree_sort_value_at (ETreeModel *etm, ETreePath path, int col, void *model_dat } return GINT_TO_POINTER (camel_message_info_date_received(msg_info)); - } + } return ml_tree_value_at (etm, path, col, model_data); @@ -1487,13 +1487,13 @@ static void message_list_init_images (void) { int i; - + /* * Only load once, and share */ if (states_pixmaps[0].pixbuf) return; - + for (i = 0; i < G_N_ELEMENTS (states_pixmaps); i++) { if (states_pixmaps[i].icon_name) states_pixmaps[i].pixbuf = e_icon_factory_get_icon (states_pixmaps[i].icon_name, E_ICON_SIZE_MENU); @@ -1510,10 +1510,10 @@ filter_date (time_t date) struct tm then, now, yesterday; char buf[26]; gboolean done = FALSE; - + if (date == 0) return g_strdup (_("?")); - + localtime_r (&date, &then); localtime_r (&nowdate, &now); if (then.tm_mday == now.tm_mday && @@ -1573,19 +1573,19 @@ static ECell * create_composite_cell (int col) gboolean show_email; int i; int alt_col = (col == COL_FROM) ? COL_SENDER : COL_RECIPIENTS; - + gconf = mail_config_get_gconf_client (); fixed_name = gconf_client_get_string (gconf, "/desktop/gnome/interface/monospace_font_name", NULL); show_email = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_email", NULL); - + cell_vbox = e_cell_vbox_new (); cell_hbox = e_cell_hbox_new (); - + for (i = 0; i < 2; i++) - images [i] = states_pixmaps [i + 5].pixbuf; + images [i] = states_pixmaps [i + 5].pixbuf; cell_attach = e_cell_toggle_new (0, 2, images); - + cell_date = e_cell_date_new(NULL, GTK_JUSTIFY_RIGHT); g_object_set (G_OBJECT (cell_date), "bold_column", COL_UNREAD, @@ -1597,16 +1597,16 @@ static ECell * create_composite_cell (int col) "bold_column", COL_UNREAD, "color_column", COL_COLOUR, NULL); - + e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_from, show_email ? col : alt_col, 68); e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_attach, COL_ATTACHMENT, 5); e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_date, COL_SENT, 27); - + cell_sub = e_cell_text_new(fixed_name? fixed_name:NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell_sub), /* "bold_column", COL_UNREAD, */ "color_column", COL_COLOUR, - NULL); + NULL); cell_tree = e_cell_tree_new (NULL, NULL, TRUE, cell_sub); e_cell_vbox_append (E_CELL_VBOX (cell_vbox), cell_hbox, COL_FROM); e_cell_vbox_append (E_CELL_VBOX (cell_vbox), cell_tree, COL_SUBJECT); @@ -1624,9 +1624,9 @@ static void composite_cell_set_strike_col (ECell *cell, int col) { g_object_set (G_OBJECT (g_object_get_data(G_OBJECT (cell), "cell_date")), "strikeout_column", col, NULL); - g_object_set (G_OBJECT (g_object_get_data(G_OBJECT (cell), "cell_from")), "strikeout_column", col, NULL); + g_object_set (G_OBJECT (g_object_get_data(G_OBJECT (cell), "cell_from")), "strikeout_column", col, NULL); } - + static ETableExtras * message_list_create_extras (void) { @@ -1641,31 +1641,31 @@ message_list_create_extras (void) e_table_extras_add_pixbuf (extras, "attachment", states_pixmaps [6].pixbuf); e_table_extras_add_pixbuf (extras, "flagged", states_pixmaps [7].pixbuf); e_table_extras_add_pixbuf (extras, "followup", states_pixmaps [15].pixbuf); - + e_table_extras_add_compare (extras, "address_compare", address_compare); - + for (i = 0; i < 5; i++) images [i] = states_pixmaps [i].pixbuf; - + e_table_extras_add_cell (extras, "render_message_status", e_cell_toggle_new (0, 5, images)); - + for (i = 0; i < 2; i++) images [i] = states_pixmaps [i + 5].pixbuf; - + e_table_extras_add_cell (extras, "render_attachment", e_cell_toggle_new (0, 2, images)); - + images [1] = states_pixmaps [7].pixbuf; e_table_extras_add_cell (extras, "render_flagged", e_cell_toggle_new (0, 2, images)); - + images[1] = states_pixmaps [15].pixbuf; images[2] = states_pixmaps [16].pixbuf; e_table_extras_add_cell (extras, "render_flag_status", e_cell_toggle_new (0, 3, images)); - + for (i = 0; i < 7; i++) images[i] = states_pixmaps [i + 7].pixbuf; - + e_table_extras_add_cell (extras, "render_score", e_cell_toggle_new (0, 7, images)); - + /* date cell */ cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), @@ -1673,7 +1673,7 @@ message_list_create_extras (void) "color_column", COL_COLOUR, NULL); e_table_extras_add_cell (extras, "render_date", cell); - + /* text cell */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), @@ -1681,11 +1681,11 @@ message_list_create_extras (void) "color_column", COL_COLOUR, NULL); e_table_extras_add_cell (extras, "render_text", cell); - - e_table_extras_add_cell (extras, "render_tree", + + e_table_extras_add_cell (extras, "render_tree", e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */ TRUE, cell)); - + /* size cell */ cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT); g_object_set (G_OBJECT (cell), @@ -1697,10 +1697,10 @@ message_list_create_extras (void) /* Composite cell for wide view */ cell = create_composite_cell (COL_FROM); e_table_extras_add_cell (extras, "render_composite_from", cell); - + cell = create_composite_cell (COL_TO); - e_table_extras_add_cell (extras, "render_composite_to", cell); - + e_table_extras_add_cell (extras, "render_composite_to", cell); + return extras; } @@ -1708,10 +1708,10 @@ static void save_tree_state(MessageList *ml) { char *filename; - + if (ml->folder == NULL || ml->tree == NULL) return; - + filename = mail_config_folder_to_cachename(ml->folder, "et-expanded-"); e_tree_save_expanded_state(ml->tree, filename); g_free(filename); @@ -1731,10 +1731,10 @@ static void load_tree_state (MessageList *ml) { char *filename; - + if (ml->folder == NULL || ml->tree == NULL) return; - + filename = mail_config_folder_to_cachename (ml->folder, "et-expanded-"); e_tree_load_expanded_state (ml->tree, filename); g_free (filename); @@ -1763,10 +1763,10 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) g_object_set (message_list->tree, "uniform_row_height", TRUE, NULL); - + name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE); d(printf ("folder name is '%s'\n", name)); - + path = mail_config_folder_to_cachename (message_list->folder, "et-expanded-"); g_object_set_data (G_OBJECT (((GnomeCanvasItem *) item)->canvas), "freeze-cursor", &data); @@ -1775,7 +1775,7 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing) e_tree_load_expanded_state (message_list->tree, path); } g_free (path); - + g_free (name); } } @@ -1849,7 +1849,7 @@ ml_tree_drag_data_get (ETree *tree, int row, ETreePath path, int col, /* Drop handling */ struct _drop_msg { struct _mail_msg msg; - + GdkDragContext *context; /* Only selection->data and selection->length are valid */ @@ -1859,7 +1859,7 @@ struct _drop_msg { guint32 action; guint info; - + unsigned int move:1; unsigned int moved:1; unsigned int aborted:1; @@ -1899,7 +1899,7 @@ ml_drop_async_done(struct _mail_msg *mm) { struct _drop_msg *m = (struct _drop_msg *)mm; gboolean success, delete; - + /* ?? */ if (m->aborted) { success = FALSE; @@ -1916,7 +1916,7 @@ static void ml_drop_async_free(struct _mail_msg *mm) { struct _drop_msg *m = (struct _drop_msg *)mm; - + g_object_unref(m->context); camel_object_unref(m->folder); @@ -2067,25 +2067,25 @@ message_list_init (MessageList *message_list) struct _MessageListPrivate *p; GtkAdjustment *adjustment; GdkAtom matom; - + adjustment = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, G_MAXDOUBLE, 0.0, 0.0, 0.0); gtk_scrolled_window_set_vadjustment ((GtkScrolledWindow *) message_list, adjustment); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (message_list), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - + message_list->normalised_hash = g_hash_table_new_full ( g_str_hash, g_str_equal, (GDestroyNotify) NULL, (GDestroyNotify) e_poolv_destroy); - + message_list->hidden = NULL; message_list->hidden_pool = NULL; message_list->hide_before = ML_HIDE_NONE_START; message_list->hide_after = ML_HIDE_NONE_END; - + message_list->search = NULL; - + message_list->hide_lock = g_mutex_new(); - + message_list->uid_nodemap = g_hash_table_new (g_str_hash, g_str_equal); message_list->async_event = mail_async_event_new(); @@ -2102,7 +2102,7 @@ message_list_init (MessageList *message_list) g_signal_connect(p->invisible, "selection_get", G_CALLBACK(ml_selection_get), message_list); g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(ml_selection_clear_event), message_list); g_signal_connect(p->invisible, "selection_received", G_CALLBACK(ml_selection_received), message_list); - + g_signal_connect (((GtkScrolledWindow *) message_list)->vscrollbar, "value-changed", G_CALLBACK (ml_scrolled), message_list); } @@ -2113,7 +2113,7 @@ message_list_destroy(GtkObject *object) struct _MessageListPrivate *p = message_list->priv; p->destroyed = TRUE; - + if (message_list->async_event) { mail_async_event_destroy(message_list->async_event); message_list->async_event = NULL; @@ -2131,7 +2131,7 @@ message_list_destroy(GtkObject *object) g_hash_table_destroy (message_list->uid_nodemap); message_list->uid_nodemap = NULL; } - + camel_object_unhook_event(message_list->folder, "folder_changed", folder_changed, message_list); camel_object_unref (message_list->folder); message_list->folder = NULL; @@ -2146,17 +2146,17 @@ message_list_destroy(GtkObject *object) g_object_unref (message_list->extras); message_list->extras = NULL; } - + if (message_list->model) { g_object_unref (message_list->model); message_list->model = NULL; } - + if (message_list->idle_id != 0) { g_source_remove (message_list->idle_id); message_list->idle_id = 0; } - + if (message_list->seen_id) { g_source_remove (message_list->seen_id); message_list->seen_id = 0; @@ -2170,9 +2170,9 @@ message_list_finalise (GObject *object) { MessageList *message_list = MESSAGE_LIST (object); struct _MessageListPrivate *p = message_list->priv; - + g_hash_table_destroy (message_list->normalised_hash); - + if (message_list->thread_tree) camel_folder_thread_messages_unref(message_list->thread_tree); @@ -2224,7 +2224,7 @@ message_list_class_init (MessageListClass *message_list_class) NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); - + message_list_signals[MESSAGE_LIST_BUILT] = g_signal_new ("message_list_built", MESSAGE_LIST_TYPE, @@ -2234,7 +2234,7 @@ message_list_class_init (MessageListClass *message_list_class) NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - + message_list_signals[MESSAGE_LIST_SCROLLED] = g_signal_new ("message_list_scrolled", MESSAGE_LIST_TYPE, @@ -2244,7 +2244,7 @@ message_list_class_init (MessageListClass *message_list_class) NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - + message_list_init_images (); } @@ -2258,35 +2258,35 @@ message_list_construct (MessageList *message_list) message_list->model = e_tree_memory_callbacks_new (ml_tree_icon_at, - + ml_column_count, - + ml_has_save_id, ml_get_save_id, - + ml_has_get_node_by_id, ml_get_node_by_id, - + ml_tree_sort_value_at, ml_tree_value_at, ml_tree_set_value_at, ml_tree_is_cell_editable, - + ml_duplicate_value, ml_free_value, ml_initialize_value, ml_value_is_empty, ml_value_to_string, - + message_list); - e_tree_memory_set_expanded_default(E_TREE_MEMORY(message_list->model), + e_tree_memory_set_expanded_default(E_TREE_MEMORY(message_list->model), gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_expand", NULL)); message_list->priv->thread_latest = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/thread_latest", NULL); - + /* * The etree */ @@ -2295,7 +2295,7 @@ message_list_construct (MessageList *message_list) etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, "message-list.etspec", NULL); construct_failed = (e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list), message_list->model, - message_list->extras, + message_list->extras, etspecfile, NULL) == FALSE); @@ -2313,7 +2313,7 @@ message_list_construct (MessageList *message_list) g_signal_connect((message_list->tree), "cursor_activated", G_CALLBACK (on_cursor_activated_cmd), message_list); - + g_signal_connect((message_list->tree), "click", G_CALLBACK (on_click), message_list); @@ -2324,14 +2324,14 @@ message_list_construct (MessageList *message_list) e_tree_drag_source_set(message_list->tree, GDK_BUTTON1_MASK, ml_drag_types, sizeof(ml_drag_types)/sizeof(ml_drag_types[0]), GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_ASK); - + g_signal_connect(message_list->tree, "tree_drag_data_get", G_CALLBACK(ml_tree_drag_data_get), message_list); e_tree_drag_dest_set(message_list->tree, GTK_DEST_DEFAULT_ALL, ml_drop_types, sizeof(ml_drop_types)/sizeof(ml_drop_types[0]), GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_ASK); - + g_signal_connect(message_list->tree, "tree_drag_data_received", G_CALLBACK(ml_tree_drag_data_received), message_list); g_signal_connect(message_list->tree, "drag-motion", G_CALLBACK(ml_tree_drag_motion), message_list); @@ -2386,7 +2386,7 @@ clear_tree (MessageList *ml) g_hash_table_foreach (ml->uid_nodemap, (GHFunc)clear_info, ml); g_hash_table_destroy (ml->uid_nodemap); ml->uid_nodemap = g_hash_table_new (g_str_hash, g_str_equal); - + if (ml->tree_root) { /* we should be frozen already */ e_tree_memory_node_remove (E_TREE_MEMORY(etm), ml->tree_root); @@ -2427,9 +2427,9 @@ is_node_selectable (MessageList *ml, CamelMessageInfo *info) flag_junk = flags & CAMEL_MESSAGE_JUNK; flag_deleted = flags & CAMEL_MESSAGE_DELETED; - /* perform actions depending on folder type */ + /* perform actions depending on folder type */ if (is_junk_folder) { - /* messages in a junk folder are selectable only if + /* messages in a junk folder are selectable only if * the message is marked as junk and if not deleted * when hidedeleted is set */ if (flag_junk && !(flag_deleted && ml->hidedeleted)) @@ -2450,7 +2450,7 @@ is_node_selectable (MessageList *ml, CamelMessageInfo *info) return FALSE; } - + /* We try and find something that is selectable in our tree. There is * actually no assurance that we'll find something that will still be @@ -2687,7 +2687,7 @@ add_node_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThre ETreePath node; g_return_if_fail (c->message != NULL); - + /* we just update the hashtable key, umm, does this leak the info on the message node? */ g_hash_table_remove(ml->uid_nodemap, camel_message_info_uid(c->message)); node = e_tree_memory_node_insert(E_TREE_MEMORY(etm), parent, myrow, (void *)c->message); @@ -2915,12 +2915,12 @@ static void message_list_change_first_visible_parent (MessageList *ml, ETreePath node) { ETreePath first_visible = NULL; - + while (node && (node = e_tree_model_node_get_parent (ml->model, node))) { if (!e_tree_node_is_expanded (ml->tree, node)) first_visible = node; } - + if (first_visible != NULL) { e_tree_model_pre_change (ml->model); e_tree_model_node_data_changed (ml->model, first_visible); @@ -2939,7 +2939,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) #ifdef TIMEIT struct timeval start, end; unsigned long diff; - + gettimeofday(&start, NULL); #endif @@ -2975,7 +2975,7 @@ build_flat_diff(MessageList *ml, CamelFolderChangeInfo *changes) if (node) { e_tree_model_pre_change (ml->model); e_tree_model_node_data_changed (ml->model, node); - + message_list_change_first_visible_parent (ml, node); } } @@ -2999,7 +2999,7 @@ mail_folder_hide_by_flag (CamelFolder *folder, MessageList *ml, CamelFolderChang int i; newchanges = camel_folder_change_info_new (); - + for (i = 0; i < oldchanges->uid_changed->len; i++) { ETreePath node = g_hash_table_lookup (ml->uid_nodemap, oldchanges->uid_changed->pdata[i]); guint32 flags; @@ -3041,17 +3041,17 @@ main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) /* may be NULL if we're in the process of being destroyed */ if (ml->async_event == NULL) return; - + d(printf("folder changed event, changes = %p\n", changes)); if (changes) { d(printf("changed = %d added = %d removed = %d\n", changes->uid_changed->len, changes->uid_added->len, changes->uid_removed->len)); - + for (i = 0; i < changes->uid_removed->len; i++) g_hash_table_remove ( ml->normalised_hash, changes->uid_removed->pdata[i]); - + /* check if the hidden state has changed, if so modify accordingly, then regenerate */ if (ml->hidejunk || ml->hidedeleted) mail_folder_hide_by_flag (folder, ml, &changes, (ml->hidejunk ? CAMEL_MESSAGE_JUNK : 0) | (ml->hidedeleted ? CAMEL_MESSAGE_DELETED : 0)); @@ -3062,18 +3062,18 @@ main_folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) if (node) { e_tree_model_pre_change (ml->model); e_tree_model_node_data_changed (ml->model, node); - + message_list_change_first_visible_parent (ml, node); } } - + camel_folder_change_info_free (changes); g_signal_emit(ml, message_list_signals[MESSAGE_LIST_BUILT], 0); return; } } - + mail_regen_list (ml, ml->search, NULL, changes); } @@ -3092,7 +3092,7 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) } else { changes = NULL; } - + mail_async_event_emit(ml->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, changes, user_data); } @@ -3114,12 +3114,12 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c gboolean hide_deleted; GConfClient *gconf; CamelException ex; - + g_return_if_fail (IS_MESSAGE_LIST (message_list)); - + if (message_list->folder == folder) return; - + camel_exception_init (&ex); /* remove the cursor activate idle handler */ @@ -3127,28 +3127,28 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c g_source_remove (message_list->idle_id); message_list->idle_id = 0; } - + /* reset the normalised sort performance hack */ g_hash_table_remove_all (message_list->normalised_hash); - + mail_regen_cancel(message_list); - + if (message_list->folder != NULL) { save_tree_state (message_list); save_hide_state (message_list); } - - e_tree_memory_freeze(E_TREE_MEMORY(etm)); + + e_tree_memory_freeze(E_TREE_MEMORY(etm)); clear_tree (message_list); e_tree_memory_thaw(E_TREE_MEMORY(etm)); - + if (message_list->folder) { camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed", folder_changed, message_list); camel_object_unref (message_list->folder); message_list->folder = NULL; } - + if (message_list->thread_tree) { camel_folder_thread_messages_unref(message_list->thread_tree); message_list->thread_tree = NULL; @@ -3158,50 +3158,50 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c g_free(message_list->folder_uri); message_list->folder_uri = uri ? g_strdup(uri):NULL; } - + if (message_list->cursor_uid) { g_free(message_list->cursor_uid); message_list->cursor_uid = NULL; g_signal_emit(message_list, message_list_signals[MESSAGE_SELECTED], 0, NULL); } - + if (folder) { int strikeout_col = -1; ECell *cell; - + camel_object_ref (folder); message_list->folder = folder; message_list->just_set_folder = TRUE; - + /* Setup the strikeout effect for non-trash folders */ if (!(folder->folder_flags & CAMEL_FOLDER_IS_TRASH)) strikeout_col = COL_DELETED; - + cell = e_table_extras_get_cell (message_list->extras, "render_date"); g_object_set (cell, "strikeout_column", strikeout_col, NULL); - + cell = e_table_extras_get_cell (message_list->extras, "render_text"); g_object_set (cell, "strikeout_column", strikeout_col, NULL); - + cell = e_table_extras_get_cell (message_list->extras, "render_size"); g_object_set (cell, "strikeout_column", strikeout_col, NULL); - cell = e_table_extras_get_cell (message_list->extras, "render_composite_from"); + cell = e_table_extras_get_cell (message_list->extras, "render_composite_from"); composite_cell_set_strike_col (cell, strikeout_col); - cell = e_table_extras_get_cell (message_list->extras, "render_composite_to"); + cell = e_table_extras_get_cell (message_list->extras, "render_composite_to"); composite_cell_set_strike_col (cell, strikeout_col); - + /* Build the etree suitable for this folder */ message_list_setup_etree (message_list, outgoing); - + camel_object_hook_event (folder, "folder_changed", folder_changed, message_list); - + gconf = mail_config_get_gconf_client (); hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL); message_list->hidedeleted = hide_deleted && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH); message_list->hidejunk = junk_folder && !(folder->folder_flags & CAMEL_FOLDER_IS_JUNK) && !(folder->folder_flags & CAMEL_FOLDER_IS_TRASH); - + load_hide_state (message_list); if (message_list->frozen == 0) mail_regen_list (message_list, message_list->search, NULL, NULL); @@ -3221,7 +3221,7 @@ on_cursor_activated_idle (gpointer data) } else { g_signal_emit (message_list, message_list_signals[MESSAGE_SELECTED], 0, NULL); } - + message_list->idle_id = 0; return FALSE; } @@ -3240,11 +3240,11 @@ on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_dat if ((message_list->cursor_uid == NULL && new_uid == NULL) || (message_list->cursor_uid != NULL && new_uid != NULL && !strcmp (message_list->cursor_uid, new_uid))) return; - + message_list->cursor_row = row; g_free (message_list->cursor_uid); message_list->cursor_uid = g_strdup (new_uid); - + if (!message_list->idle_id) { message_list->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_activated_idle, @@ -3298,7 +3298,7 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess flag = CAMEL_MESSAGE_FLAGGED; else return FALSE; - + if (!(info = get_message_info (list, path))) return FALSE; @@ -3307,21 +3307,21 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess /* If a message was marked as deleted and the user flags it as important, marks it as needing a reply, marks it as unread, then undelete the message. */ - if (flags & CAMEL_MESSAGE_DELETED) { + if (flags & CAMEL_MESSAGE_DELETED) { if (col == COL_FLAGGED && !(flags & CAMEL_MESSAGE_FLAGGED)) flag |= CAMEL_MESSAGE_DELETED; - + if (col == COL_MESSAGE_STATUS && (flags & CAMEL_MESSAGE_SEEN)) flag |= CAMEL_MESSAGE_DELETED; } - + camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~flags); - + if (flag == CAMEL_MESSAGE_SEEN && list->seen_id) { g_source_remove (list->seen_id); list->seen_id = 0; } - + return TRUE; } @@ -3418,18 +3418,18 @@ void message_list_free_uids(MessageList *ml, GPtrArray *uids) } /* set whether we are in threaded view or flat view */ -void +void message_list_set_threaded_expand_all (MessageList *ml) { if (ml->threaded) { ml->expand_all = 1; - + if (ml->frozen == 0) mail_regen_list (ml, ml->search, NULL, NULL); - } + } } - -void + +void message_list_set_threaded_collapse_all (MessageList *ml) { if (ml->threaded) { @@ -3439,13 +3439,13 @@ message_list_set_threaded_collapse_all (MessageList *ml) mail_regen_list (ml, ml->search, NULL, NULL); } } - + void message_list_set_threaded (MessageList *ml, gboolean threaded) { if (ml->threaded != threaded) { ml->threaded = threaded; - + if (ml->frozen == 0) mail_regen_list (ml, ml->search, NULL, NULL); } @@ -3456,7 +3456,7 @@ message_list_set_expand_all (MessageList *ml, gboolean threaded) { if (ml->threaded != threaded) { ml->threaded = threaded; - + if (ml->frozen == 0) mail_regen_list (ml, ml->search, NULL, NULL); } @@ -3467,7 +3467,7 @@ message_list_set_hidedeleted (MessageList *ml, gboolean hidedeleted) { if (ml->hidedeleted != hidedeleted) { ml->hidedeleted = hidedeleted; - + if (ml->frozen == 0) mail_regen_list (ml, ml->search, NULL, NULL); } @@ -3479,7 +3479,7 @@ message_list_set_search (MessageList *ml, const char *search) if (search == NULL || search[0] == '\0') if (ml->search == NULL || ml->search[0] == '\0') return; - + if (search != NULL && ml->search != NULL && strcmp (search, ml->search) == 0) return; @@ -3556,14 +3556,14 @@ void message_list_hide_add (MessageList *ml, const char *expr, unsigned int lower, unsigned int upper) { MESSAGE_LIST_LOCK (ml, hide_lock); - + if (lower != ML_HIDE_SAME) ml->hide_before = lower; if (upper != ML_HIDE_SAME) ml->hide_after = upper; - + MESSAGE_LIST_UNLOCK (ml, hide_lock); - + mail_regen_list (ml, ml->search, expr, NULL); } @@ -3582,7 +3582,7 @@ message_list_hide_uids (MessageList *ml, GPtrArray *uids) ml->hidden = g_hash_table_new (g_str_hash, g_str_equal); ml->hidden_pool = e_mempool_new (512, 256, E_MEMPOOL_ALIGN_BYTE); } - + uid = e_mempool_strdup (ml->hidden_pool, uids->pdata[i]); g_hash_table_insert (ml->hidden, uid, uid); for ( ; i < uids->len; i++) { @@ -3666,7 +3666,7 @@ load_hide_state (MessageList *ml) ml->hide_after = upper; while (!feof(in)) { char *olduid, *uid; - + if (camel_file_util_decode_string (in, &olduid) != -1) { uid = e_mempool_strdup(ml->hidden_pool, olduid); g_free (olduid); @@ -3694,10 +3694,10 @@ save_hide_state (MessageList *ml) { char *filename; FILE *out; - + if (ml->folder == NULL) return; - + MESSAGE_LIST_LOCK(ml, hide_lock); filename = mail_config_folder_to_cachename(ml->folder, "hidestate-"); @@ -3759,7 +3759,7 @@ regen_list_regen (struct _mail_msg *mm) GPtrArray *uids, *uidnew, *showuids, *searchuids = NULL; CamelMessageInfo *info; int i; - + if (m->folder != m->ml->folder) return; @@ -3803,49 +3803,49 @@ regen_list_regen (struct _mail_msg *mm) uids = camel_folder_get_uids (m->folder); } } - + if (camel_exception_is_set (&mm->ex)) return; - + /* perform hiding */ if (m->hideexpr && camel_folder_has_search_capability(m->folder)) { uidnew = camel_folder_search_by_expression (m->ml->folder, m->hideexpr, &mm->ex); /* well, lets not abort just because this faileld ... */ camel_exception_clear (&mm->ex); - + if (uidnew) { MESSAGE_LIST_LOCK(m->ml, hide_lock); - + if (m->ml->hidden == NULL) { m->ml->hidden = g_hash_table_new (g_str_hash, g_str_equal); m->ml->hidden_pool = e_mempool_new (512, 256, E_MEMPOOL_ALIGN_BYTE); } - + for (i = 0; i < uidnew->len; i++) { if (g_hash_table_lookup (m->ml->hidden, uidnew->pdata[i]) == NULL) { char *uid = e_mempool_strdup (m->ml->hidden_pool, uidnew->pdata[i]); g_hash_table_insert (m->ml->hidden, uid, uid); } } - + MESSAGE_LIST_UNLOCK(m->ml, hide_lock); - + camel_folder_search_free (m->ml->folder, uidnew); } } - + MESSAGE_LIST_LOCK(m->ml, hide_lock); - + m->ml->hide_unhidden = uids->len; - + /* what semantics do we want from hide_before, hide_after? probably <0 means measure from the end of the list */ - + /* perform uid hiding */ if (m->ml->hidden || m->ml->hide_before != ML_HIDE_NONE_START || m->ml->hide_after != ML_HIDE_NONE_END) { int start, end; uidnew = g_ptr_array_new (); - + /* first, hide matches */ if (m->ml->hidden) { for (i = 0; i < uids->len; i++) { @@ -3853,26 +3853,26 @@ regen_list_regen (struct _mail_msg *mm) g_ptr_array_add (uidnew, uids->pdata[i]); } } - + /* then calculate the subrange visible and chop it out */ m->ml->hide_unhidden = uidnew->len; - + if (m->ml->hide_before != ML_HIDE_NONE_START || m->ml->hide_after != ML_HIDE_NONE_END) { GPtrArray *uid2 = g_ptr_array_new (); - + start = m->ml->hide_before; if (start < 0) start += m->ml->hide_unhidden; end = m->ml->hide_after; if (end < 0) end += m->ml->hide_unhidden; - + start = MAX(start, 0); end = MIN(end, uidnew->len); for (i = start; i < end; i++) { g_ptr_array_add (uid2, uidnew->pdata[i]); } - + g_ptr_array_free (uidnew, TRUE); uidnew = uid2; } @@ -3881,11 +3881,11 @@ regen_list_regen (struct _mail_msg *mm) uidnew = NULL; showuids = uids; } - + MESSAGE_LIST_UNLOCK(m->ml, hide_lock); e_profile_event_emit("list.threaduids", m->folder->full_name, 0); - + if (!camel_operation_cancel_check(mm->cancel)) { /* update/build a new tree */ if (m->dotree) { @@ -3901,7 +3901,7 @@ regen_list_regen (struct _mail_msg *mm) g_ptr_array_add(m->summary, info); } } - + m->complete = TRUE; } @@ -3921,10 +3921,10 @@ regen_list_regened (struct _mail_msg *mm) if (m->ml->priv->destroyed) return; - + if (!m->complete) return; - + if (camel_operation_cancel_check(mm->cancel)) return; @@ -3938,20 +3938,20 @@ regen_list_regened (struct _mail_msg *mm) m->ml->just_set_folder = FALSE; else /* Saving the tree state causes bug 352695 but fixes bug 387312 */ save_tree_state (m->ml); - + build_tree (m->ml, m->tree, m->changes); if (m->ml->thread_tree) camel_folder_thread_messages_unref(m->ml->thread_tree); m->ml->thread_tree = m->tree; m->tree = NULL; - + if (m->ml->expand_all) load_tree_expand_all (m->ml, TRUE); else if (m->ml->collapse_all) load_tree_expand_all (m->ml, FALSE); else load_tree_state (m->ml); - + m->ml->expand_all = FALSE; m->ml->collapse_all = FALSE; } else @@ -3988,15 +3988,15 @@ regen_list_free (struct _mail_msg *mm) camel_folder_free_message_info (m->folder, m->summary->pdata[i]); g_ptr_array_free (m->summary, TRUE); } - + if (m->tree) camel_folder_thread_messages_unref (m->tree); - + g_free (m->search); g_free (m->hideexpr); - + camel_object_unref (m->folder); - + if (m->changes) camel_folder_change_info_free (m->changes); @@ -4034,10 +4034,10 @@ mail_regen_cancel(MessageList *ml) /* cancel any outstanding regeneration requests, not we don't clear, they clear themselves */ if (ml->regen) { GList *l = ml->regen; - + while (l) { struct _mail_msg *mm = l->data; - + if (mm->cancel) camel_operation_cancel(mm->cancel); l = l->next; @@ -4070,10 +4070,10 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came mail_regen_cancel(ml); gconf = mail_config_get_gconf_client (); - + #ifndef BROKEN_ETREE /* this can sometimes crash,so ... */ - + /* see if we need to goto the child thread at all anyway */ /* currently the only case is the flat view with updates and no search */ if (hideexpr == NULL && search == NULL && changes != NULL && !ml->threaded) { diff --git a/mail/message-list.h b/mail/message-list.h index b5d577be0f..21cd784c00 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -60,14 +60,14 @@ enum { COL_RECIPIENTS, COL_MIXED_SENDER, COL_MIXED_RECIPIENTS, - + /* normalised strings */ COL_FROM_NORM, COL_SUBJECT_NORM, COL_TO_NORM, - + COL_LAST, - + /* Invisible columns */ COL_DELETED, COL_UNREAD, @@ -100,34 +100,34 @@ struct _MessageList { char *folder_uri; GHashTable *uid_nodemap; /* uid (from info) -> tree node mapping */ - + GHashTable *normalised_hash; - + /* UID's to hide. Keys in the mempool */ /* IMPORTANT: You MUST have obtained the hide lock, to operate on this data */ GHashTable *hidden; struct _EMemPool *hidden_pool; int hide_unhidden; /* total length, before hiding */ int hide_before, hide_after; /* hide ranges of messages */ - + /* Current search string, or %NULL */ char *search; - + /* are we regenerating the message_list because set_folder was just called? */ guint just_set_folder : 1; - + /* Are we displaying threaded view? */ guint threaded : 1; guint expand_all :1; guint collapse_all :1; - + /* do we automatically hide deleted messages? */ guint hidedeleted : 1; /* do we automatically hide junk messages? */ guint hidejunk : 1; - + /* frozen count */ guint frozen:16; diff --git a/mail/message-tag-editor.c b/mail/message-tag-editor.c index 3e45a41b73..d398b7b8d2 100644 --- a/mail/message-tag-editor.c +++ b/mail/message-tag-editor.c @@ -42,7 +42,7 @@ GType message_tag_editor_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (MessageTagEditorClass), @@ -55,10 +55,10 @@ message_tag_editor_get_type (void) 0, (GInstanceInitFunc) message_tag_editor_init, }; - + type = g_type_register_static (gtk_dialog_get_type (), "MessageTagEditor", &info, 0); } - + return type; } @@ -66,11 +66,11 @@ static void message_tag_editor_class_init (MessageTagEditorClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - + parent_class = g_type_class_ref (gtk_dialog_get_type ()); - + object_class->finalize = message_tag_editor_finalise; - + klass->get_tag_list = get_tag_list; klass->set_tag_list = set_tag_list; } @@ -83,7 +83,7 @@ message_tag_editor_init (MessageTagEditor *editor) GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - + gtk_dialog_set_default_response (GTK_DIALOG (editor), GTK_RESPONSE_OK); } @@ -92,7 +92,7 @@ static void message_tag_editor_finalise (GObject *obj) { /*MessageTagEditor *editor = (MessageTagEditor *) obj;*/ - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -106,7 +106,7 @@ CamelTag * message_tag_editor_get_tag_list (MessageTagEditor *editor) { g_return_val_if_fail (IS_MESSAGE_TAG_EDITOR (editor), NULL); - + return MESSAGE_TAG_EDITOR_GET_CLASS (editor)->get_tag_list (editor); } @@ -123,6 +123,6 @@ message_tag_editor_set_tag_list (MessageTagEditor *editor, CamelTag *tags) { g_return_if_fail (IS_MESSAGE_TAG_EDITOR (editor)); g_return_if_fail (tags != NULL); - + MESSAGE_TAG_EDITOR_GET_CLASS (editor)->set_tag_list (editor, tags); } diff --git a/mail/message-tag-editor.h b/mail/message-tag-editor.h index 3a7e850f34..cc96b648a7 100644 --- a/mail/message-tag-editor.h +++ b/mail/message-tag-editor.h @@ -46,16 +46,16 @@ typedef struct _MessageTagEditorClass MessageTagEditorClass; struct _MessageTagEditor { GtkDialog parent; - + }; struct _MessageTagEditorClass { GtkDialogClass parent_class; - + /* virtual methods */ CamelTag * (*get_tag_list) (MessageTagEditor *editor); void (*set_tag_list) (MessageTagEditor *editor, CamelTag *tags); - + /* signals */ }; diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c index ed1d4516c5..668c7b9637 100644 --- a/mail/message-tag-followup.c +++ b/mail/message-tag-followup.c @@ -94,7 +94,7 @@ GType message_tag_followup_get_type (void) { static GType type = 0; - + if (!type) { static const GTypeInfo info = { sizeof (MessageTagFollowUpClass), @@ -107,10 +107,10 @@ message_tag_followup_get_type (void) 0, (GInstanceInitFunc) message_tag_followup_init, }; - + type = g_type_register_static (message_tag_editor_get_type (), "MessageTagFollowUp", &info, 0); } - + return type; } @@ -119,11 +119,11 @@ message_tag_followup_class_init (MessageTagFollowUpClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); MessageTagEditorClass *editor_class = (MessageTagEditorClass *) klass; - + parent_class = g_type_class_ref (message_tag_editor_get_type ()); - + object_class->finalize = message_tag_followup_finalise; - + editor_class->get_tag_list = get_tag_list; editor_class->set_tag_list = set_tag_list; } @@ -143,9 +143,9 @@ static void message_tag_followup_finalise (GObject *obj) { MessageTagFollowUp *editor = (MessageTagFollowUp *) obj; - + editor->completed_date = 0; - + G_OBJECT_CLASS (parent_class)->finalize (obj); } @@ -157,9 +157,9 @@ get_tag_list (MessageTagEditor *editor) CamelTag *tags = NULL; time_t date; char *text; - + camel_tag_set (&tags, "follow-up", gtk_entry_get_text (GTK_ENTRY (followup->combo->entry))); - + date = e_date_edit_get_time (followup->target_date); if (date != (time_t) -1) { text = camel_header_format_date (date, 0); @@ -168,7 +168,7 @@ get_tag_list (MessageTagEditor *editor) } else { camel_tag_set (&tags, "due-by", ""); } - + if (gtk_toggle_button_get_active (followup->completed)) { text = camel_header_format_date (followup->completed_date, 0); camel_tag_set (&tags, "completed-on", text); @@ -176,7 +176,7 @@ get_tag_list (MessageTagEditor *editor) } else { camel_tag_set (&tags, "completed-on", ""); } - + return tags; } @@ -186,11 +186,11 @@ set_tag_list (MessageTagEditor *editor, CamelTag *tags) MessageTagFollowUp *followup = (MessageTagFollowUp *) editor; const char *text; time_t date; - + text = camel_tag_get (&tags, "follow-up"); if (text) gtk_entry_set_text (GTK_ENTRY (followup->combo->entry), text); - + text = camel_tag_get (&tags, "due-by"); if (text && *text) { date = camel_header_decode_date (text, NULL); @@ -198,7 +198,7 @@ set_tag_list (MessageTagEditor *editor, CamelTag *tags) } else { e_date_edit_set_time (followup->target_date, (time_t) -1); } - + text = camel_tag_get (&tags, "completed-on"); if (text && *text) { date = camel_header_decode_date (text, NULL); @@ -213,9 +213,9 @@ static void clear_clicked (GtkButton *button, gpointer user_data) { MessageTagFollowUp *followup = user_data; - + gtk_list_select_item (GTK_LIST (followup->combo->list), DEFAULT_FLAG); - + e_date_edit_set_time (followup->target_date, (time_t) -1); gtk_toggle_button_set_active (followup->completed, FALSE); } @@ -224,7 +224,7 @@ static void completed_toggled (GtkToggleButton *button, gpointer user_data) { MessageTagFollowUp *followup = user_data; - + if (gtk_toggle_button_get_active (followup->completed)) followup->completed_date = time (NULL); else @@ -235,7 +235,7 @@ static int get_week_start_day (void) { GConfClient *gconf; - + gconf = mail_config_get_gconf_client (); return gconf_client_get_int (gconf, "/apps/evolution/calendar/display/week_start_day", NULL); } @@ -245,7 +245,7 @@ locale_supports_12_hour_format (void) { char s[16]; time_t t = 0; - + strftime(s, sizeof s, "%p", gmtime (&t)); return s[0] != '\0'; } @@ -259,24 +259,24 @@ target_date_new (const char *s1, const char *s2, int i1, int i2) GConfClient *gconf; GtkWidget *widget; int start; - + widget = e_date_edit_new (); e_date_edit_set_show_date (E_DATE_EDIT (widget), TRUE); e_date_edit_set_show_time (E_DATE_EDIT (widget), TRUE); - + /* Note that this is 0 (Sun) to 6 (Sat), conver to 0 (mon) to 6 (sun) */ start = (get_week_start_day () + 6) % 7; - + if (locale_supports_12_hour_format ()) { gconf = mail_config_get_gconf_client (); time_24hour = gconf_client_get_bool (gconf, "/apps/evolution/calendar/display/use_24hour_format", NULL); } - + e_date_edit_set_week_start_day (E_DATE_EDIT (widget), start); e_date_edit_set_use_24_hour_format (E_DATE_EDIT (widget), time_24hour); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), TRUE); e_date_edit_set_time_popup_range (E_DATE_EDIT (widget), 0, 24); - + return widget; } @@ -293,9 +293,9 @@ construct (MessageTagEditor *editor) GdkPixbuf *pixbuf; int i; char *gladefile; - + gtk_window_set_title (GTK_WINDOW (editor), _("Flag to Follow Up")); - + icon_list = e_icon_factory_get_icon_list ("stock_mail-flag-for-followup"); if (icon_list) { gtk_window_set_icon_list (GTK_WINDOW (editor), icon_list); @@ -312,30 +312,30 @@ construct (MessageTagEditor *editor) NULL); gui = glade_xml_new (gladefile, "followup_editor", NULL); g_free (gladefile); - + widget = glade_xml_get_widget (gui, "toplevel"); - + /* reparent */ gtk_widget_reparent (widget, GTK_DIALOG (editor)->vbox); gtk_box_set_child_packing (GTK_BOX (GTK_DIALOG (editor)->vbox), widget, TRUE, TRUE, 6, GTK_PACK_START); - + widget = glade_xml_get_widget (gui, "pixmap"); pixbuf = e_icon_factory_get_icon ("stock_mail-flag-for-followup", E_ICON_SIZE_DIALOG); gtk_image_set_from_pixbuf ((GtkImage *)widget, pixbuf); g_object_unref (pixbuf); - + followup->message_list = GTK_TREE_VIEW (glade_xml_get_widget (gui, "message_list")); model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_view_set_model (followup->message_list, (GtkTreeModel *) model); - + renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (followup->message_list, -1, _("From"), renderer, "text", 0, NULL); - + renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (followup->message_list, -1, _("Subject"), renderer, "text", 1, NULL); - + followup->combo = GTK_COMBO (glade_xml_get_widget (gui, "combo")); gtk_combo_set_case_sensitive (followup->combo, FALSE); strings = NULL; @@ -344,18 +344,18 @@ construct (MessageTagEditor *editor) gtk_combo_set_popdown_strings (followup->combo, strings); g_list_free (strings); gtk_list_select_item (GTK_LIST (followup->combo->list), DEFAULT_FLAG); - + followup->target_date = E_DATE_EDIT (glade_xml_get_widget (gui, "target_date")); /* glade bug, need to show this ourselves */ gtk_widget_show ((GtkWidget *) followup->target_date); e_date_edit_set_time (followup->target_date, (time_t) -1); - + followup->completed = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "completed")); g_signal_connect (followup->completed, "toggled", G_CALLBACK (completed_toggled), followup); - + followup->clear = GTK_BUTTON (glade_xml_get_widget (gui, "clear")); g_signal_connect (followup->clear, "clicked", G_CALLBACK (clear_clicked), followup); - + g_object_unref (gui); } @@ -363,10 +363,10 @@ MessageTagEditor * message_tag_followup_new (void) { MessageTagEditor *editor; - + editor = (MessageTagEditor *) g_object_new (message_tag_followup_get_type (), NULL); construct (editor); - + return editor; } @@ -375,11 +375,11 @@ message_tag_followup_append_message (MessageTagFollowUp *editor, const char *fro { GtkTreeIter iter; GtkListStore *model; - + g_return_if_fail (IS_MESSAGE_TAG_FOLLOWUP (editor)); - + model = (GtkListStore *) gtk_tree_view_get_model (editor->message_list); - + gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, 0, from, 1, subject, -1); } diff --git a/mail/message-tag-followup.h b/mail/message-tag-followup.h index b870406260..a31dbd5df0 100644 --- a/mail/message-tag-followup.h +++ b/mail/message-tag-followup.h @@ -43,21 +43,21 @@ typedef struct _MessageTagFollowUpClass MessageTagFollowUpClass; struct _MessageTagFollowUp { MessageTagEditor parent; - + struct _GtkTreeView *message_list; - + struct _GtkCombo *combo; - + struct _EDateEdit *target_date; struct _GtkToggleButton *completed; struct _GtkButton *clear; - + time_t completed_date; }; struct _MessageTagFollowUpClass { MessageTagEditorClass parent_class; - + /* virtual methods */ /* signals */ }; |