aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Doulik <rodo@src.gnome.org>2001-06-29 00:21:14 +0800
committerRadek Doulik <rodo@src.gnome.org>2001-06-29 00:21:14 +0800
commit3460368f5986462c91b18f1a7c9ffac67031f9cd (patch)
tree1c7f8d75c6474d8672addc5a3e60272eb9cec6eb
parent2a0952de00e5d4c2327ceb11ba00e5ea1ce9b97d (diff)
downloadgsoc2013-evolution-3460368f5986462c91b18f1a7c9ffac67031f9cd.tar.gz
gsoc2013-evolution-3460368f5986462c91b18f1a7c9ffac67031f9cd.tar.zst
gsoc2013-evolution-3460368f5986462c91b18f1a7c9ffac67031f9cd.zip
simplified(refactored) signature handling + better support for html
signatures svn path=/trunk/; revision=10563
-rw-r--r--composer/e-msg-composer.c83
-rw-r--r--composer/e-msg-composer.h9
-rw-r--r--composer/evolution-composer.c14
3 files changed, 37 insertions, 69 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index c077e8b673..c14b784703 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -638,7 +638,7 @@ read_file_content (gint fd)
}
static char *
-get_file_content (char *file_name, gboolean convert, guint flags)
+get_file_content (const gchar *file_name, gboolean convert, guint flags)
{
gint fd;
char *raw;
@@ -682,20 +682,11 @@ get_file_content (char *file_name, gboolean convert, guint flags)
static char *
get_sig_file_content (const char *sigfile, gboolean in_html)
{
- gchar *file_name;
- gchar *htmlsig = NULL;
-
if (!sigfile || !*sigfile) {
return NULL;
}
- file_name = in_html ? g_strconcat (sigfile, ".html", NULL) : (gchar *) sigfile;
-
- htmlsig = get_file_content (file_name, !in_html, 0);
-
- if (in_html) g_free (file_name);
-
- return htmlsig;
+ return get_file_content (sigfile, !in_html, 0);
}
static void
@@ -728,19 +719,37 @@ prepare_engine (EMsgComposer *composer)
CORBA_exception_free (&ev);
}
+static const gchar *
+get_sig_file (EMsgComposer *composer)
+{
+
+ return NULL;
+}
+
static gchar *
get_signature_html (EMsgComposer *composer)
{
- gboolean format_html = composer->send_html;
- gchar *text, *html = NULL;
+ gboolean format_html = FALSE;
+ gchar *text, *html = NULL, *sig_file = NULL;
- text = get_sig_file_content (composer->sig_file, format_html);
- /* if we tried HTML sig and it's not available, try also non HTML signature */
- if (format_html && !text) {
- format_html = FALSE;
- text = get_sig_file_content (composer->sig_file, format_html);
+ if (E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id) {
+ MailConfigIdentity *id;
+
+ id = E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id;
+ if (composer->send_html) {
+ if (id->has_html_signature) {
+ sig_file = id->html_signature;
+ format_html = TRUE;
+ } else
+ sig_file = id->signature;
+ } else
+ sig_file = id->signature;
}
+ if (!sig_file)
+ return NULL;
+
+ text = get_sig_file_content (sig_file, format_html);
if (text) {
html = g_strdup_printf ("<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->"
"<TABLE WIDTH=\"100%%\" CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD>"
@@ -1160,7 +1169,7 @@ menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path)
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "delete", &ev);
GNOME_GtkHTML_Editor_Engine_setParagraphData (composer->editor_engine, "signature", "0", &ev);
GNOME_GtkHTML_Editor_Engine_setParagraphData (composer->editor_engine, "orig", "0", &ev);
- e_msg_composer_set_sig_file (composer, composer->sig_file);
+ e_msg_composer_show_sig_file (composer);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "style-normal", &ev);
GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_undo_end (composer->editor_engine, &ev);
@@ -1558,7 +1567,7 @@ from_changed_cb (EMsgComposerHdrs *hdrs,
composer = E_MSG_COMPOSER (data);
- e_msg_composer_set_sig_file (composer, hdrs->account->id->signature);
+ e_msg_composer_show_sig_file (composer);
}
@@ -2053,14 +2062,13 @@ e_msg_composer_new (void)
* Return value: A pointer to the newly created widget
**/
EMsgComposer *
-e_msg_composer_new_with_sig_file (const char *sig_file, gboolean send_html)
+e_msg_composer_new_with_sig_file ()
{
EMsgComposer *new;
new = create_composer ();
if (new) {
- new->sig_file = g_strdup (sig_file);
- e_msg_composer_set_send_html (new, send_html);
+ e_msg_composer_set_send_html (new, mail_config_get_send_html ());
set_editor_text (new, "");
}
@@ -2679,7 +2687,7 @@ delete_old_signature (EMsgComposer *composer)
* Set a signature
**/
void
-e_msg_composer_set_sig_file (EMsgComposer *composer, const char *sig_file)
+e_msg_composer_show_sig_file (EMsgComposer *composer)
{
CORBA_Environment ev;
gchar *html;
@@ -2696,12 +2704,6 @@ e_msg_composer_set_sig_file (EMsgComposer *composer, const char *sig_file)
GNOME_GtkHTML_Editor_Engine_undo_begin (composer->editor_engine, "Set signature", "Reset signature", &ev);
delete_old_signature (composer);
-
- if (composer->sig_file != sig_file && (!sig_file || !composer->sig_file || strcmp (composer->sig_file, sig_file))) {
- g_free (composer->sig_file);
- composer->sig_file = g_strdup (sig_file);
- }
-
html = get_signature_html (composer);
if (html) {
if (!GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (composer->editor_engine, &ev))
@@ -2720,24 +2722,6 @@ e_msg_composer_set_sig_file (EMsgComposer *composer, const char *sig_file)
}
/**
- * e_msg_composer_get_sig_file:
- * @composer: A message composer widget
- *
- * Get the signature file
- *
- * Return value: The signature file.
- **/
-const char *
-e_msg_composer_get_sig_file (EMsgComposer *composer)
-{
- g_return_val_if_fail (composer != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
-
- return composer->sig_file;
-}
-
-
-/**
* e_msg_composer_set_send_html:
* @composer: A message composer widget
* @send_html: Whether the composer should have the "Send HTML" flag set
@@ -2771,8 +2755,7 @@ e_msg_composer_set_send_html (EMsgComposer *composer,
composer->send_html, NULL);
set_config (composer, "FormatHTML", composer->send_html);
- if (composer->sig_file)
- e_msg_composer_set_sig_file (composer, composer->sig_file);
+ e_msg_composer_show_sig_file (composer);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "unblock-redraw", &ev);
CORBA_exception_free (&ev);
}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 7f0db7e16b..61cdff256b 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -73,8 +73,6 @@ struct _EMsgComposer {
Bonobo_PropertyBag property_bag;
- char *sig_file;
-
gboolean attachment_bar_visible : 1;
gboolean send_html : 1;
gboolean pgp_sign : 1;
@@ -102,8 +100,7 @@ struct _EMsgComposerClass {
GtkType e_msg_composer_get_type (void);
void e_msg_composer_construct (EMsgComposer *composer);
EMsgComposer *e_msg_composer_new (void);
-EMsgComposer *e_msg_composer_new_with_sig_file (const char *sig_file,
- gboolean send_html);
+EMsgComposer *e_msg_composer_new_with_sig_file (void);
EMsgComposer *e_msg_composer_new_with_message (CamelMimeMessage *msg);
EMsgComposer *e_msg_composer_new_from_url (const char *url);
void e_msg_composer_show_attachments (EMsgComposer *composer,
@@ -122,9 +119,7 @@ void e_msg_composer_add_header (EMsgComposer *compose
void e_msg_composer_attach (EMsgComposer *composer,
CamelMimePart *attachment);
CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer);
-void e_msg_composer_set_sig_file (EMsgComposer *composer,
- const char *sig_file);
-const char *e_msg_composer_get_sig_file (EMsgComposer *composer);
+void e_msg_composer_show_sig_file (EMsgComposer *composer);
gboolean e_msg_composer_get_send_html (EMsgComposer *composer);
void e_msg_composer_set_send_html (EMsgComposer *composer,
gboolean send_html);
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
index ef9456c1aa..6dfddf1202 100644
--- a/composer/evolution-composer.c
+++ b/composer/evolution-composer.c
@@ -257,19 +257,9 @@ static void
init (EvolutionComposer *composer)
{
const MailConfigAccount *account;
- gboolean send_html;
- gchar *sig_file = NULL;
- account = mail_config_get_default_account ();
- send_html = mail_config_get_send_html ();
-
- if (account->id)
- sig_file = account->id->signature;
-
- if (sig_file)
- composer->composer = e_msg_composer_new_with_sig_file (sig_file, send_html);
- else
- composer->composer = e_msg_composer_new ();
+ account = mail_config_get_default_account ();
+ composer->composer = e_msg_composer_new_with_sig_file ();
gtk_signal_connect (GTK_OBJECT (composer->composer), "send",
GTK_SIGNAL_FUNC (send_cb), NULL);
git/cgit.cgi/freebsd-ports-gnome/commit/multimedia?id=3cae12a0aec28c7afa5ffb975c75e9c0ce8dc7cd'>- Fix build on 11.x+amdmi32016-09-041-0/+11 * Put MASTER_SITES in the right locationrakuco2016-09-041-1/+1 * Put MASTER_SITES in the right locationrakuco2016-09-041-1/+1 * Switch to USES=pathfixrakuco2016-09-042-12/+1 * Switch to USES=pathfix.rakuco2016-09-042-12/+1 * Resolve warning about bad symlink in stage-qa with GUI (gmplayer->mplayer)riggs2016-09-041-1/+1 * Add DVDNAV to default options to allow the mencoder package to access DVDsriggs2016-09-041-3/+3 * Resolve dependency conflict on armv6; disable HARFBUZZ OPTIONriggs2016-09-031-0/+1 * multimedia/plexmediaserver{-plexpass}: Update to 1.1.3feld2016-09-016-22/+23 * - Add LICENSE_FILEamdmi32016-09-011-2/+2 * - Remove bogus USES=tar:bzip2amdmi32016-09-011-3/+1 * - Update mpv to 0.20.0cpm2016-09-012-15/+10 * multimedia/freetuxtv: revbump required after previous changesmarino2016-09-011-0/+1 * multimedia/emby-server: Update to 3.0.6400woodsb022016-08-303-5/+9 * multimedia/emby-server: Update to 3.0.6300woodsb022016-08-283-112/+28 * multimedia/plexmediaserver-plexpass: Update to 1.1.2feld2016-08-273-8/+8 * - Convert to USES=localbase sqlitepawel2016-08-272-10/+10 * Update to upstream version 9.4.0, update USES for QT5 OPTIONriggs2016-08-262-5/+5 * multimedia/vapoursynth: update to r33.1jbeich2016-08-263-6/+9 * - Switch to USES=taramdmi32016-08-242-6/+8 * Replace Mk/bsd.kde4.mk by Mk/Uses/kde.mk in preparation for KDE Frameworks andtcberner2016-08-2417-42/+42 * multimedia/xawtv: document ncurses requirementmarino2016-08-241-1/+1 * - Update to 0.10.2olivierd2016-08-242-116/+61 * - Update to 1.1.1olivierd2016-08-242-14/+9 * - Update to 1.1.2olivierd2016-08-242-114/+60 * multimedia/emby-server: Update to 3.0.6070woodsb022016-08-233-11/+21 * Fix build and update to 1.30crees2016-08-223-6/+27 * - Update mpv to 0.19.0cpm2016-08-203-11/+25 * Fix UTF-8 subtitle rendering: Make FONTCONFIG a default OPTIONriggs2016-08-201-1/+2 * multimedia/plexmediaserver-plexpass: Update to 1.1.0feld2016-08-193-17/+14 * multimedia/plexmediaserver: Change the way binaries are strippedfeld2016-08-191-1/+2 * multimedia/plexpy: Update to 1.4.10feld2016-08-163-4/+5 * Add a Qt5 option to multimedia/mlttcberner2016-08-162-14/+24 * - Update to version 3.2.3 [1]pawel2016-08-163-12/+10 * multimedia/plexpy: Update to 1.4.9feld2016-08-153-5/+107 * Update distfiles, add NO_ARCH, bump PORTREVISIONriggs2016-08-143-7/+10 * multimedia/libmtp: update to 1.1.12jbeich2016-08-142-3/+4 * Import py-cec 0.2.5kevlo2016-08-114-0/+29 * multimedia/emby-server: Update to 3.0.6060woodsb022016-08-113-4/+5 * - Remove REALPLAYER_DESC linecpm2016-08-101-1/+0 * Remove expired port:rene2016-08-106-410/+0 * Drop support for expired port multimedia/linux-realplayerriggs2016-08-104-8/+3 * multimedia/emby-server: Update to 3.0.6050woodsb022016-08-093-43/+4 * - Drop support for expired multimedia/linux-realplayercpm2016-08-091-6/+2 * Fix build with mono 4.4.romain2016-08-091-0/+16 * Remove expired port:rene2016-08-094-70/+0 * multimedia/obs-studio: Update to 0.15.2koobs2016-08-083-17/+32 * multimedia/emby-server: Update to 3.0.6030woodsb022016-08-083-11/+15 * Update to upstream release 16.1riggs2016-08-073-7/+6 * - Depend on sqlalchemy to fix buildstabthorpe2016-08-071-2/+3 * - Update to 16.8.0, please seenemysis2016-08-052-3/+4 * multimedia ... sysutils: Remove redundant dependency on unzipmarino2016-08-042-2/+0 * - Update to version 11.7, take maintainership [1]pawel2016-08-0410-39/+38 * Don't use extension.ini any more, and have each extension install in itsmat2016-08-031-0/+1 * Use LINUX_REPO_ARCH instead of LINUX_RPM_ARCH when setting DISTINFO_FILEtijl2016-08-014-0/+0 * multimedia/emby-server: Update to 3.0.6020woodsb022016-07-303-47/+69 * Use getline(3) from libc instead of bundled onebapt2016-07-301-0/+1 * multimedia/plexmediaserver{-plexpass}: Update to 1.0.3feld2016-07-304-10/+10 * multimedia/zoneminder: Upgrade from 1.30.0-rc1 to 1.30.0-rc2tz2016-07-274-26/+17 * multimedia/emby-server: Update to 3.0.6000woodsb022016-07-243-850/+51 * Fix build (remove unnecessary reinplacement)riggs2016-07-231-2/+1 * multimedia/plexpy: Update to 1.4.8feld2016-07-233-4/+35 * multimedia/plexmediaserver{-plexpass}: Update to 1.0.2feld2016-07-235-16/+23 * Cleanup $() variables in ports Makefiles.mat2016-07-205-6/+6 * - update libgd to 2.2.2dinoex2016-07-20