aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorRadek Doulik <rodo@ximian.com>2002-03-08 07:10:47 +0800
committerRadek Doulik <rodo@src.gnome.org>2002-03-08 07:10:47 +0800
commit5326b38eaaffc00e770def17b5fcc4d8be3e8472 (patch)
treea5caac91f604b3bfb374125f51bbe57db9d614b7 /mail
parent3227c579dc08b9a78074930839b2aec86a8ed681 (diff)
downloadgsoc2013-evolution-5326b38eaaffc00e770def17b5fcc4d8be3e8472.tar
gsoc2013-evolution-5326b38eaaffc00e770def17b5fcc4d8be3e8472.tar.gz
gsoc2013-evolution-5326b38eaaffc00e770def17b5fcc4d8be3e8472.tar.bz2
gsoc2013-evolution-5326b38eaaffc00e770def17b5fcc4d8be3e8472.tar.lz
gsoc2013-evolution-5326b38eaaffc00e770def17b5fcc4d8be3e8472.tar.xz
gsoc2013-evolution-5326b38eaaffc00e770def17b5fcc4d8be3e8472.tar.zst
gsoc2013-evolution-5326b38eaaffc00e770def17b5fcc4d8be3e8472.zip
notify accounts dialog about signature content change
2002-03-07 Radek Doulik <rodo@ximian.com> * mail-signature-editor.c: notify accounts dialog about signature content change * mail-accounts.c (run_script): run script only if file regular file exists and has x flag svn path=/trunk/; revision=15979
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/mail-account-gui.c4
-rw-r--r--mail/mail-accounts.c23
-rw-r--r--mail/mail-config.glade18
-rw-r--r--mail/mail-config.h2
-rw-r--r--mail/mail-signature-editor.c28
-rw-r--r--mail/mail-signature-editor.h2
7 files changed, 60 insertions, 23 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b2788e545a..dd2e4aff18 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -10,6 +10,12 @@
2002-03-07 Radek Doulik <rodo@ximian.com>
+ * mail-signature-editor.c: notify accounts dialog about signature
+ content change
+
+ * mail-accounts.c (run_script): run script only if file regular
+ file exists and has x flag
+
* mail-signature-editor.c (mail_signature_editor): set initial
focus to editor
(do_exit): use hasUndo to avoid question dialog when content is
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 981a1b98e9..c532e1a0c3 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -1103,7 +1103,7 @@ sig_edit_text (GtkWidget *w, MailAccountGui *gui)
return;
if (sig->filename && *sig->filename)
- mail_signature_editor (sig->filename, sig->html);
+ mail_signature_editor (sig);
else
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Please specify signature filename\nin Andvanced section of signature settings."));
@@ -1118,7 +1118,7 @@ sig_edit_html (GtkWidget *w, MailAccountGui *gui)
return;
if (sig->filename && *sig->filename)
- mail_signature_editor (sig->filename, sig->html);
+ mail_signature_editor (sig);
else
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Please specify signature filename\nin Andvanced section of signature settings."));
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index d8573221f6..be24b7d64c 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -822,6 +822,20 @@ dialog_destroy (GtkWidget *dialog, gpointer user_data)
/* Signatures */
static void
+run_script (gchar *script)
+{
+ struct stat s;
+
+ if (stat (script, &s))
+ return;
+
+ if (!S_ISREG (s.st_mode) || !(s.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)))
+ return;
+
+ mail_config_signature_run_script (script);
+}
+
+static void
sig_load_preview (MailAccountsDialog *dialog, MailConfigSignature *sig)
{
gchar *str;
@@ -831,7 +845,7 @@ sig_load_preview (MailAccountsDialog *dialog, MailConfigSignature *sig)
return;
}
- mail_config_signature_run_script (sig->script);
+ run_script (sig->script);
str = e_msg_composer_get_sig_file_content (sig->filename, sig->html);
if (!str)
str = g_strdup (" ");
@@ -874,7 +888,7 @@ sig_edit (GtkWidget *w, MailAccountsDialog *dialog)
MailConfigSignature *sig = sig_current_sig (dialog);
if (sig->filename && *sig->filename)
- mail_signature_editor (sig->filename, sig->html);
+ mail_signature_editor (sig);
else
e_notice (GTK_WINDOW (dialog), GNOME_MESSAGE_BOX_ERROR,
_("Please specify signature filename\nin Andvanced section of signature settings."));
@@ -1115,6 +1129,11 @@ sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccoun
case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED:
printf ("accounts NAME CHANGED\n");
break;
+ case MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED:
+ printf ("accounts CONTENT CHANGED\n");
+ if (sig == sig_current_sig (dialog))
+ sig_load_preview (dialog, sig);
+ break;
default:
;
}
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 1741cf334f..5d87d490f6 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -3587,6 +3587,18 @@ Quoted
<label>_Delete</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label66</name>
+ <label> </label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
</widget>
<widget>
@@ -3615,7 +3627,7 @@ Quoted
<tooltip>Show advanced settings</tooltip>
<can_default>True</can_default>
<can_focus>True</can_focus>
- <label>Ad_vanced</label>
+ <label>Ad_vanced &gt;&gt;</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
@@ -3630,7 +3642,7 @@ Quoted
<tooltip>Hide advanced settings</tooltip>
<can_default>True</can_default>
<can_focus>True</can_focus>
- <label>S_imple</label>
+ <label>&lt;&lt; S_imple</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
@@ -3642,7 +3654,7 @@ Quoted
<widget>
<class>GtkLabel</class>
<name>label65</name>
- <label> </label>
+ <label> </label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
diff --git a/mail/mail-config.h b/mail/mail-config.h
index d78aa0c7f2..fb227f6f58 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -264,6 +264,8 @@ void mail_config_signature_set_random (MailConfigSignature *sig, gboolean random
typedef enum {
MAIL_CONFIG_SIG_EVENT_NAME_CHANGED,
+ MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED,
+ MAIL_CONFIG_SIG_EVENT_HTML_CHANGED,
MAIL_CONFIG_SIG_EVENT_RANDOM_ON,
MAIL_CONFIG_SIG_EVENT_RANDOM_OFF,
MAIL_CONFIG_SIG_EVENT_ADDED,
diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c
index 9d06dd9095..45821a1028 100644
--- a/mail/mail-signature-editor.c
+++ b/mail/mail-signature-editor.c
@@ -15,8 +15,7 @@ struct _ESignatureEditor {
GtkWidget *win;
GtkWidget *control;
- gchar *filename;
- gboolean html;
+ MailConfigSignature *sig;
GNOME_GtkHTML_Editor_Engine engine;
};
@@ -33,7 +32,6 @@ static void
destroy_editor (ESignatureEditor *editor)
{
gtk_widget_destroy (editor->win);
- g_free (editor->filename);
g_free (editor);
}
@@ -56,12 +54,12 @@ menu_file_save_cb (BonoboUIComponent *uic,
CORBA_Environment ev;
editor = E_SIGNATURE_EDITOR (data);
- if (editor->html) {
+ if (editor->sig->html) {
CORBA_exception_init (&ev);
pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
"IDL:Bonobo/PersistFile:1.0", NULL);
- Bonobo_PersistFile_save (pfile_iface, editor->filename, &ev);
+ Bonobo_PersistFile_save (pfile_iface, editor->sig->filename, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
menu_file_save_error (uic, &ev);
@@ -74,7 +72,7 @@ menu_file_save_cb (BonoboUIComponent *uic,
CORBA_exception_init (&ev);
- stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, editor->filename,
+ stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, editor->sig->filename,
Bonobo_Storage_WRITE | Bonobo_Storage_CREATE, 0);
pstream_iface = bonobo_object_client_query_interface
@@ -91,6 +89,7 @@ menu_file_save_cb (BonoboUIComponent *uic,
CORBA_exception_free (&ev);
bonobo_object_unref (BONOBO_OBJECT (stream));
}
+ mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED, editor->sig);
}
static void
@@ -182,20 +181,20 @@ load_signature (ESignatureEditor *editor)
{
CORBA_Environment ev;
- if (editor->html) {
+ if (editor->sig->html) {
Bonobo_PersistFile pfile_iface;
pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
"IDL:Bonobo/PersistFile:1.0", NULL);
CORBA_exception_init (&ev);
- Bonobo_PersistFile_load (pfile_iface, editor->filename, &ev);
+ Bonobo_PersistFile_load (pfile_iface, editor->sig->filename, &ev);
CORBA_exception_free (&ev);
} else {
Bonobo_PersistStream pstream_iface;
BonoboStream *stream;
gchar *data, *html;
- data = e_msg_composer_get_sig_file_content (editor->filename, FALSE);
+ data = e_msg_composer_get_sig_file_content (editor->sig->filename, FALSE);
html = g_strdup_printf ("<PRE>\n%s", data);
g_free (data);
@@ -227,7 +226,7 @@ load_signature (ESignatureEditor *editor)
}
void
-mail_signature_editor (const gchar *filename, gboolean html)
+mail_signature_editor (MailConfigSignature *sig)
{
CORBA_Environment ev;
ESignatureEditor *editor;
@@ -235,15 +234,14 @@ mail_signature_editor (const gchar *filename, gboolean html)
BonoboUIContainer *container;
gchar *title;
- if (!filename || !*filename)
+ if (!sig->filename || !*sig->filename)
return;
editor = g_new0 (ESignatureEditor, 1);
- editor->html = html;
- editor->filename = g_strdup (filename);
+ editor->sig = sig;
- title = g_strdup_printf ("Edit %ssignature (%s)", html ? "HTML " : "", filename);
+ title = g_strdup_printf ("Edit signature (%s)", sig->filename);
editor->win = bonobo_window_new ("e-sig-editor", title);
gtk_window_set_default_size (GTK_WINDOW (editor->win), DEFAULT_WIDTH, DEFAULT_HEIGHT);
gtk_window_set_policy (GTK_WINDOW (editor->win), FALSE, TRUE, FALSE);
@@ -277,7 +275,7 @@ mail_signature_editor (const gchar *filename, gboolean html)
GTK_SIGNAL_FUNC (delete_event_cb), editor);
bonobo_window_set_contents (BONOBO_WINDOW (editor->win), editor->control);
- bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", html, NULL);
+ bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", sig->html, NULL);
gtk_widget_show (GTK_WIDGET (editor->win));
gtk_widget_show (GTK_WIDGET (editor->control));
diff --git a/mail/mail-signature-editor.h b/mail/mail-signature-editor.h
index 741a066470..bcce6412d9 100644
--- a/mail/mail-signature-editor.h
+++ b/mail/mail-signature-editor.h
@@ -31,7 +31,7 @@ extern "C" {
#include <glib.h>
-void mail_signature_editor (const gchar *filename, gboolean html);
+void mail_signature_editor (MailConfigSignature *sig);
#ifdef __cplusplus
}