aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@src.gnome.org>2002-07-23 07:53:11 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-07-23 07:53:11 +0800
commit4f5bca2bc90fba82ae2172280a7954ef32cb918f (patch)
treede107b568533c01085411ac9182a9ac6c3c95721 /composer
parent26524d4a05dc4bb8cde52f7ca52d4e8af4e9b717 (diff)
downloadgsoc2013-evolution-4f5bca2bc90fba82ae2172280a7954ef32cb918f.tar.gz
gsoc2013-evolution-4f5bca2bc90fba82ae2172280a7954ef32cb918f.tar.zst
gsoc2013-evolution-4f5bca2bc90fba82ae2172280a7954ef32cb918f.zip
more cleanup
svn path=/trunk/; revision=17539
Diffstat (limited to 'composer')
-rw-r--r--composer/e-msg-composer.c156
1 files changed, 78 insertions, 78 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index d3aff4395c..451392c3ff 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1751,14 +1751,14 @@ signature_cb (GtkWidget *w, EMsgComposer *composer)
{
MailConfigSignature *old_sig;
gboolean old_auto;
- gint idx = g_list_index (GTK_MENU_SHELL (w)->children, gtk_menu_get_active (GTK_MENU (w)));
- gint len = g_list_length (GTK_MENU_SHELL (w)->children);
-
+ int idx = g_list_index (GTK_MENU_SHELL (w)->children, gtk_menu_get_active (GTK_MENU (w)));
+ int len = g_list_length (GTK_MENU_SHELL (w)->children);
+
/* printf ("signature_cb: %d\n", idx); */
-
+
old_sig = composer->signature;
old_auto = composer->auto_signature;
-
+
if (idx < len - 2) {
if (idx == 0) { /* none */
composer->signature = NULL;
@@ -1777,23 +1777,23 @@ signature_cb (GtkWidget *w, EMsgComposer *composer)
sig_select_item (composer);
} else if (idx == len - 1 && composer->hdrs && E_MSG_COMPOSER_HDRS (composer->hdrs)->account) {
const MailConfigAccount *account = E_MSG_COMPOSER_HDRS (composer->hdrs)->account;
-
+
if (account->id) {
GtkWidget *omenu, *menu;
MailConfigAccount *orig_acc;
- gint i;
-
+ int i;
+
/*
* this is not exact, because the composer uses duplicates of accounts
* so I have to guess which account it is.
* in 1.4 we have to have account derived from gobject and composer should just
* ref it and not duplicate
*/
-
+
omenu = e_msg_composer_hdrs_get_from_omenu (E_MSG_COMPOSER_HDRS (composer->hdrs));
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu));
i = g_list_index (GTK_MENU_SHELL (menu)->children, gtk_menu_get_active (GTK_MENU (menu)));
-
+
orig_acc = g_slist_nth_data ((GSList *) mail_config_get_accounts (), i);
if (orig_acc) {
if (orig_acc->name && account->name && !strcmp (orig_acc->name, account->name)
@@ -1812,7 +1812,7 @@ signature_cb (GtkWidget *w, EMsgComposer *composer)
&& ((orig_acc->id->organization == NULL && account->id->organization == NULL)
|| (orig_acc->id->organization && account->id->organization
&& !strcmp (orig_acc->id->organization, account->id->organization)))) {
-
+
orig_acc->id->def_signature = composer->signature;
orig_acc->id->auto_signature = composer->auto_signature;
mail_config_write_account_sig (orig_acc, -1);
@@ -1854,15 +1854,15 @@ prepare_signatures_menu (EMsgComposer *composer)
{
GtkWidget *hbox;
GtkWidget *label;
-
+
hbox = e_msg_composer_hdrs_get_from_hbox (E_MSG_COMPOSER_HDRS (composer->hdrs));
-
+
label = gtk_label_new (_("Signature:"));
gtk_widget_show (label);
-
+
composer->sig_omenu = gtk_option_menu_new ();
gtk_widget_show (composer->sig_omenu);
-
+
gtk_box_pack_end_defaults (GTK_BOX (hbox), composer->sig_omenu);
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, TRUE, 0);
}
@@ -1870,8 +1870,8 @@ prepare_signatures_menu (EMsgComposer *composer)
static void
sig_select_item (EMsgComposer *composer)
{
- gint idx;
-
+ int idx;
+
if (composer->auto_signature) {
idx = 1;
} else if (composer->signature == NULL) {
@@ -1879,7 +1879,7 @@ sig_select_item (EMsgComposer *composer)
} else {
idx = composer->signature->id + 2;
}
-
+
gtk_option_menu_set_history (GTK_OPTION_MENU (composer->sig_omenu), idx);
}
@@ -1890,21 +1890,21 @@ setup_signatures_menu (EMsgComposer *composer)
gint len = 0;
GtkWidget *menu;
GtkWidget *mi;
-
+
#define ADD(x) \
mi = (x ? gtk_menu_item_new_with_label (x) : gtk_menu_item_new ()); \
gtk_widget_show (mi); \
gtk_menu_append (GTK_MENU (menu), mi);
-
+
menu = gtk_menu_new ();
ADD (_("None"));
ADD (_("Autogenerated"));
-
+
list = mail_config_get_signature_list ();
if (list)
for (l = list; l; len ++, l = l->next) {
gchar *gtk_str;
-
+
gtk_str = e_utf8_to_gtk_string (menu, ((MailConfigSignature *)l->data)->name);
ADD (gtk_str);
g_free (gtk_str);
@@ -1912,11 +1912,11 @@ setup_signatures_menu (EMsgComposer *composer)
ADD (NULL);
ADD (_("Set as default"));
#undef ADD
-
+
gtk_widget_show (menu);
gtk_option_menu_set_menu (GTK_OPTION_MENU (composer->sig_omenu), menu);
sig_select_item (composer);
-
+
gtk_signal_connect (GTK_OBJECT (menu), "selection-done", signature_cb, composer);
}
@@ -2225,7 +2225,7 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data)
update_auto_recipients (hdrs, UPDATE_AUTO_CC, NULL);
update_auto_recipients (hdrs, UPDATE_AUTO_BCC, NULL);
}
-
+
set_editor_signature (composer);
e_msg_composer_show_sig_file (composer);
}
@@ -2252,17 +2252,17 @@ destroy (GtkObject *object)
CORBA_Environment ev;
composer = E_MSG_COMPOSER (object);
-
+
mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, composer);
-
+
CORBA_exception_init (&ev);
-
+
if (composer->config_db) {
Bonobo_ConfigDatabase_sync (composer->config_db, &ev);
bonobo_object_release_unref (composer->config_db, NULL);
}
composer->config_db = NULL;
-
+
if (composer->uic)
bonobo_object_unref (BONOBO_OBJECT (composer->uic));
composer->uic = NULL;
@@ -2510,7 +2510,7 @@ init (EMsgComposer *composer)
composer->inline_images = g_hash_table_new (g_str_hash, g_str_equal);
composer->inline_images_by_url = g_hash_table_new (g_str_hash, g_str_equal);
composer->current_images = NULL;
-
+
composer->attachment_bar_visible = FALSE;
composer->send_html = FALSE;
composer->pgp_sign = FALSE;
@@ -2558,16 +2558,16 @@ load_from_config_db (EMsgComposer *composer)
{
Bonobo_ConfigDatabase db = composer->config_db;
- composer->view_from = bonobo_config_get_long_with_default (db,
- "Mail/Composer/ViewFrom", 1, NULL);
- composer->view_replyto = bonobo_config_get_long_with_default (db,
- "Mail/Composer/ViewReplyTo", 0, NULL);
- composer->view_bcc = bonobo_config_get_long_with_default (db,
- "Mail/Composer/ViewBCC", 0, NULL);
- composer->view_cc = bonobo_config_get_long_with_default (db,
- "Mail/Composer/ViewCC", 1, NULL);
- composer->view_subject = bonobo_config_get_long_with_default (db,
- "Mail/Composer/ViewSubject", 1, NULL);
+ composer->view_from = bonobo_config_get_long_with_default (
+ db, "Mail/Composer/ViewFrom", 1, NULL);
+ composer->view_replyto = bonobo_config_get_long_with_default (
+ db, "Mail/Composer/ViewReplyTo", 0, NULL);
+ composer->view_bcc = bonobo_config_get_long_with_default (
+ db, "Mail/Composer/ViewBCC", 0, NULL);
+ composer->view_cc = bonobo_config_get_long_with_default (
+ db, "Mail/Composer/ViewCC", 1, NULL);
+ composer->view_subject = bonobo_config_get_long_with_default (
+ db, "Mail/Composer/ViewSubject", 1, NULL);
}
static void
@@ -2578,7 +2578,7 @@ e_msg_composer_load_config (EMsgComposer *composer)
CORBA_exception_init (&ev);
- db = bonobo_get_object ( "wombat:", "Bonobo/ConfigDatabase", &ev);
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
if (ev._major == CORBA_NO_EXCEPTION && db != CORBA_OBJECT_NIL){
composer->config_db = db;
@@ -2589,7 +2589,7 @@ e_msg_composer_load_config (EMsgComposer *composer)
CORBA_exception_free (&ev);
}
-static gint
+static int
e_msg_composer_get_visible_flags (EMsgComposer *composer)
{
int flags = 0;
@@ -2624,9 +2624,9 @@ map_default_cb (EMsgComposer *composer, gpointer user_data)
Bonobo_PropertyBag pb = CORBA_OBJECT_NIL;
char *text;
CORBA_Environment ev;
-
+
/* If the 'To:' field is empty, focus it (This is ridiculously complicated) */
-
+
to = e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs));
cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (to));
pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
@@ -2641,9 +2641,9 @@ map_default_cb (EMsgComposer *composer, gpointer user_data)
g_free (text);
/* If not, check the subject field */
-
+
text = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs));
-
+
if (!text || text[0] == '\0') {
GtkWidget *widget;
@@ -2653,9 +2653,9 @@ map_default_cb (EMsgComposer *composer, gpointer user_data)
return;
}
g_free (text);
-
+
/* Jump to the editor as a last resort. */
-
+
CORBA_exception_init (&ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "grab-focus", &ev);
CORBA_exception_free (&ev);
@@ -2665,7 +2665,7 @@ static void
msg_composer_destroy_notify (void *data)
{
EMsgComposer *composer = E_MSG_COMPOSER (data);
-
+
all_composers = g_slist_remove (all_composers, composer);
}
@@ -2675,18 +2675,18 @@ create_composer (void)
EMsgComposer *composer;
GtkWidget *vbox;
BonoboObject *editor_server;
- gint vis;
+ int vis;
g_return_val_if_fail (gtk_main_level () > 0, NULL);
-
+
composer = gtk_type_new (E_TYPE_MSG_COMPOSER);
all_composers = g_slist_prepend (all_composers, composer);
-
+
gtk_signal_connect (GTK_OBJECT (composer), "destroy",
GTK_SIGNAL_FUNC (msg_composer_destroy_notify),
NULL);
-
+
gtk_window_set_default_size (GTK_WINDOW (composer),
DEFAULT_WIDTH, DEFAULT_HEIGHT);
gnome_window_icon_set_from_file (GTK_WINDOW (composer), EVOLUTION_DATADIR
@@ -2725,7 +2725,7 @@ create_composer (void)
gtk_signal_connect (GTK_OBJECT (composer->hdrs), "from_changed",
GTK_SIGNAL_FUNC (from_changed_cb), composer);
gtk_widget_show (composer->hdrs);
-
+
prepare_signatures_menu (composer);
setup_signatures_menu (composer);
@@ -2819,9 +2819,9 @@ set_editor_signature (EMsgComposer *composer)
composer->signature = id->def_signature;
composer->auto_signature = id->auto_signature;
-
+
/* printf ("auto: %d\n", id->auto_signature); */
-
+
sig_select_item (composer);
}
/* printf ("set_editor_signature end\n"); */
@@ -3340,7 +3340,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
* the attachment bar has all the attachments, before we request them.
*/
e_msg_composer_flush_pending_body (new, TRUE);
-
+
set_editor_signature (new);
return new;
@@ -3351,7 +3351,7 @@ disable_editor (EMsgComposer *composer)
{
gtk_widget_set_sensitive (composer->editor, FALSE);
gtk_widget_set_sensitive (composer->attachment_bar, FALSE);
-
+
bonobo_ui_component_set_prop (composer->uic, "/menu/Edit", "sensitive", "0", NULL);
bonobo_ui_component_set_prop (composer->uic, "/menu/Format", "sensitive", "0", NULL);
bonobo_ui_component_set_prop (composer->uic, "/menu/Insert", "sensitive", "0", NULL);
@@ -3616,13 +3616,13 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body,
const char *mime_type)
{
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
+
set_editor_text (composer, U_("<b>(The composer contains a non-text "
"message body, which cannot be "
"editted.)<b>"));
e_msg_composer_set_send_html (composer, FALSE);
disable_editor (composer);
-
+
g_free (composer->mime_body);
composer->mime_body = g_strdup (body);
g_free (composer->mime_type);
@@ -3664,7 +3664,7 @@ void
e_msg_composer_attach (EMsgComposer *composer, CamelMimePart *attachment)
{
EMsgComposerAttachmentBar *bar;
-
+
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
g_return_if_fail (CAMEL_IS_MIME_PART (attachment));
@@ -3693,19 +3693,19 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
CamelDataWrapper *wrapper;
CamelMimePart *part;
struct stat statbuf;
-
+
/* check for regular file */
if (stat (file_name, &statbuf) < 0 || !S_ISREG (statbuf.st_mode))
return NULL;
-
+
stream = camel_stream_fs_new_with_name (file_name, O_RDONLY, 0);
if (!stream)
return NULL;
-
+
wrapper = camel_data_wrapper_new ();
camel_data_wrapper_construct_from_stream (wrapper, stream);
camel_object_unref (CAMEL_OBJECT (stream));
-
+
mime_type = e_msg_composer_guess_mime_type (file_name);
camel_data_wrapper_set_mime_type (wrapper, mime_type ? mime_type : "application/octet-stream");
g_free (mime_type);
@@ -3713,19 +3713,19 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
part = camel_mime_part_new ();
camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper);
camel_object_unref (CAMEL_OBJECT (wrapper));
-
+
cid = header_msgid_generate ();
camel_mime_part_set_content_id (part, cid);
camel_mime_part_set_filename (part, g_basename (file_name));
camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_BASE64);
-
+
url = g_strdup_printf ("file:%s", file_name);
g_hash_table_insert (composer->inline_images_by_url, url, part);
-
+
url = g_strdup_printf ("cid:%s", cid);
g_hash_table_insert (composer->inline_images, url, part);
g_free (cid);
-
+
return part;
}
@@ -3743,17 +3743,17 @@ e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer,
{
char *cid, *url;
const char *location;
-
+
cid = (char *)camel_mime_part_get_content_id (part);
if (!cid) {
camel_mime_part_set_content_id (part, NULL);
cid = (char *)camel_mime_part_get_content_id (part);
}
-
+
url = g_strdup_printf ("cid:%s", cid);
g_hash_table_insert (composer->inline_images, url, part);
camel_object_ref (CAMEL_OBJECT (part));
-
+
location = camel_mime_part_get_content_location (part);
if (location) {
g_hash_table_insert (composer->inline_images_by_url,
@@ -3829,7 +3829,7 @@ static void
delete_old_signature (EMsgComposer *composer)
{
CORBA_Environment ev;
-
+
/* printf ("delete_old_signature\n"); */
CORBA_exception_init (&ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-bod", &ev);
@@ -3859,16 +3859,16 @@ e_msg_composer_show_sig_file (EMsgComposer *composer)
char *html;
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
+
/* printf ("e_msg_composer_show_sig_file\n"); */
/* printf ("set sig '%s' '%s'\n", sig_file, composer->sig_file); */
-
+
composer->in_signature_insert = TRUE;
CORBA_exception_init (&ev);
GNOME_GtkHTML_Editor_Engine_freeze (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-save", &ev);
GNOME_GtkHTML_Editor_Engine_undoBegin (composer->editor_engine, "Set signature", "Reset signature", &ev);
-
+
delete_old_signature (composer);
html = get_signature_html (composer);
if (html) {
@@ -3884,13 +3884,13 @@ e_msg_composer_show_sig_file (EMsgComposer *composer)
GNOME_GtkHTML_Editor_Engine_insertHTML (composer->editor_engine, html, &ev);
g_free (html);
}
-
+
GNOME_GtkHTML_Editor_Engine_undoEnd (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-restore", &ev);
GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev);
CORBA_exception_free (&ev);
composer->in_signature_insert = FALSE;
-
+
/* printf ("e_msg_composer_show_sig_file end\n"); */
}