aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorRadek Doulik <rodo@ximian.com>2002-03-09 07:04:09 +0800
committerRadek Doulik <rodo@src.gnome.org>2002-03-09 07:04:09 +0800
commit20a28f53fc442fd51d0abaf45d1066cc42aa3885 (patch)
tree95b89d306876c505529444f9f46e51626970a38f /mail
parent91c99e0e5ae2a2cf3558916bce63e009fb16483e (diff)
downloadgsoc2013-evolution-20a28f53fc442fd51d0abaf45d1066cc42aa3885.tar
gsoc2013-evolution-20a28f53fc442fd51d0abaf45d1066cc42aa3885.tar.gz
gsoc2013-evolution-20a28f53fc442fd51d0abaf45d1066cc42aa3885.tar.bz2
gsoc2013-evolution-20a28f53fc442fd51d0abaf45d1066cc42aa3885.tar.lz
gsoc2013-evolution-20a28f53fc442fd51d0abaf45d1066cc42aa3885.tar.xz
gsoc2013-evolution-20a28f53fc442fd51d0abaf45d1066cc42aa3885.tar.zst
gsoc2013-evolution-20a28f53fc442fd51d0abaf45d1066cc42aa3885.zip
new function
2002-03-08 Radek Doulik <rodo@ximian.com> * mail-config.c (mail_config_signature_set_html): new function * mail-accounts.c (sig_event_client): watch for HTML changed event * mail-signature-editor.c: added HTML check menu item to Format menu svn path=/trunk/; revision=15996
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-accounts.c5
-rw-r--r--mail/mail-config.c12
-rw-r--r--mail/mail-config.h1
-rw-r--r--mail/mail-signature-editor.c30
5 files changed, 54 insertions, 3 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 85c30a0d43..094adad125 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2002-03-08 Radek Doulik <rodo@ximian.com>
+
+ * mail-config.c (mail_config_signature_set_html): new function
+
+ * mail-accounts.c (sig_event_client): watch for HTML changed event
+
+ * mail-signature-editor.c: added HTML check menu item to Format
+ menu
+
2002-03-08 Dan Winship <danw@ximian.com>
* mail-config-druid.c (management_prepare): Rewrite this to not
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 75eb77cfa7..08e198d13c 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -1152,6 +1152,11 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccoun
if (sig == sig_current_sig (dialog))
sig_load_preview (dialog, sig);
break;
+ case MAIL_CONFIG_SIG_EVENT_HTML_CHANGED:
+ printf ("accounts HTML CHANGED\n");
+ if (sig == sig_current_sig (dialog))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->sig_html), sig->html);
+ break;
default:
;
}
diff --git a/mail/mail-config.c b/mail/mail-config.c
index c8dc7cfa60..64cd4c7f9a 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -2954,6 +2954,7 @@ mail_config_signature_set_filename (MailConfigSignature *sig, const gchar *filen
delete_unused_signature_file (old_filename);
g_free (old_filename);
}
+ mail_config_signature_write (sig);
}
void
@@ -2979,6 +2980,7 @@ mail_config_signature_set_random (MailConfigSignature *sig, gboolean random)
mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_RANDOM_OFF, sig);
}
sig->random = random;
+ mail_config_signature_write (sig);
}
}
@@ -3035,3 +3037,13 @@ mail_config_signature_run_script (gchar *script)
waitpid (pid, &status, 0);
}
}
+
+void
+mail_config_signature_set_html (MailConfigSignature *sig, gboolean html)
+{
+ if (sig->html != html) {
+ sig->html = html;
+ mail_config_signature_write (sig);
+ mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_HTML_CHANGED, sig);
+ }
+}
diff --git a/mail/mail-config.h b/mail/mail-config.h
index fb227f6f58..b9872960ef 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -259,6 +259,7 @@ MailConfigSignature *mail_config_signature_add (gboolean html);
void mail_config_signature_delete (MailConfigSignature *sig);
void mail_config_signature_write (MailConfigSignature *sig);
void mail_config_signature_set_name (MailConfigSignature *sig, const gchar *name);
+void mail_config_signature_set_html (MailConfigSignature *sig, gboolean html);
void mail_config_signature_set_filename (MailConfigSignature *sig, const gchar *filename);
void mail_config_signature_set_random (MailConfigSignature *sig, gboolean random);
diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c
index 58c18639c7..b68e13b84d 100644
--- a/mail/mail-signature-editor.c
+++ b/mail/mail-signature-editor.c
@@ -18,6 +18,7 @@ struct _ESignatureEditor {
GtkWidget *name_entry;
MailConfigSignature *sig;
+ gboolean html;
GNOME_GtkHTML_Editor_Engine engine;
};
@@ -56,7 +57,7 @@ menu_file_save_cb (BonoboUIComponent *uic,
CORBA_Environment ev;
editor = E_SIGNATURE_EDITOR (data);
- if (editor->sig->html) {
+ if (editor->html) {
CORBA_exception_init (&ev);
pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
@@ -91,6 +92,8 @@ menu_file_save_cb (BonoboUIComponent *uic,
CORBA_exception_free (&ev);
bonobo_object_unref (BONOBO_OBJECT (stream));
}
+ editor->sig->html = editor->html;
+
mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED, editor->sig);
}
@@ -183,7 +186,7 @@ load_signature (ESignatureEditor *editor)
{
CORBA_Environment ev;
- if (editor->sig->html) {
+ if (editor->html) {
Bonobo_PersistFile pfile_iface;
pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
@@ -233,6 +236,23 @@ sig_name_changed (GtkWidget *w, ESignatureEditor *editor)
mail_config_signature_set_name (editor->sig, e_utf8_gtk_entry_get_text (GTK_ENTRY (editor->name_entry)));
}
+static void
+format_html_cb (BonoboUIComponent *component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ gpointer data)
+
+{
+ ESignatureEditor *editor = (ESignatureEditor *) data;
+
+ if (type != Bonobo_UIComponent_STATE_CHANGED)
+ return;
+
+ editor->html = atoi (state);
+ bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", editor->html, NULL);
+}
+
void
mail_signature_editor (MailConfigSignature *sig)
{
@@ -249,6 +269,7 @@ mail_signature_editor (MailConfigSignature *sig)
editor = g_new0 (ESignatureEditor, 1);
editor->sig = sig;
+ editor->html = sig->html;
title = g_strdup_printf ("Edit signature (%s)", sig->filename);
editor->win = bonobo_window_new ("e-sig-editor", title);
@@ -280,6 +301,9 @@ mail_signature_editor (MailConfigSignature *sig)
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);
+
gtk_signal_connect (GTK_OBJECT (editor->win), "delete_event",
GTK_SIGNAL_FUNC (delete_event_cb), editor);
@@ -296,7 +320,7 @@ mail_signature_editor (MailConfigSignature *sig)
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", sig->html, NULL);
+ bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", editor->html, NULL);
gtk_widget_show (GTK_WIDGET (editor->win));
gtk_widget_show (GTK_WIDGET (editor->control));