aboutsummaryrefslogtreecommitdiffstats
path: root/composer/listener.c
diff options
context:
space:
mode:
Diffstat (limited to 'composer/listener.c')
-rw-r--r--composer/listener.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/composer/listener.c b/composer/listener.c
index 8b13b0be64..0ed868a104 100644
--- a/composer/listener.c
+++ b/composer/listener.c
@@ -94,6 +94,18 @@ reply_indent (EditorListener *l, CORBA_Environment * ev)
GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "cursor-position-restore", ev);
}
+static void
+clear_signature (GNOME_GtkHTML_Editor_Engine e, CORBA_Environment * ev)
+{
+ if (GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (e, ev))
+ GNOME_GtkHTML_Editor_Engine_setParagraphData (e, "signature", "0", ev);
+ else if (GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty (e, ev)
+ && GNOME_GtkHTML_Editor_Engine_runCommand (e, "cursor-backward", ev)) {
+ GNOME_GtkHTML_Editor_Engine_setParagraphData (e, "signature", "0", ev);
+ GNOME_GtkHTML_Editor_Engine_runCommand (e, "cursor-forward", ev);
+ }
+}
+
static CORBA_any *
impl_event (PortableServer_Servant _servant,
const CORBA_char * name, const CORBA_any * arg,
@@ -101,17 +113,24 @@ impl_event (PortableServer_Servant _servant,
{
EditorListener *l = listener_from_servant (_servant);
CORBA_any *rv = NULL;
- CORBA_char *orig;
/* printf ("impl_event\n"); */
if (!strcmp (name, "command")) {
- /* FIXME check for insert-paragraph command */
- orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev);
- if (ev->_major == CORBA_NO_EXCEPTION) {
- if (!strcmp (orig, "1"))
- reply_indent (l, ev);
- GNOME_GtkHTML_Editor_Engine_setParagraphData (l->composer->editor_engine, "orig", "0", ev);
+ if (!l->composer->in_signature_insert) {
+ CORBA_char *orig, *signature;
+ /* FIXME check for insert-paragraph command */
+ orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev);
+ if (ev->_major == CORBA_NO_EXCEPTION) {
+ if (orig && *orig == '1')
+ reply_indent (l, ev);
+ GNOME_GtkHTML_Editor_Engine_setParagraphData (l->composer->editor_engine, "orig", "0", ev);
+ }
+ signature = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "signature", ev);
+ if (ev->_major == CORBA_NO_EXCEPTION) {
+ if (signature && *signature == '1')
+ clear_signature (l->composer->editor_engine, ev);
+ }
}
} else if (!strcmp (name, "image_url")) {
gchar *url;
@@ -119,7 +138,7 @@ impl_event (PortableServer_Servant _servant,
if ((url = resolve_image_url (l, BONOBO_ARG_GET_STRING (arg)))) {
rv = bonobo_arg_new (TC_string);
BONOBO_ARG_SET_STRING (rv, url);
- printf ("new url: %s\n", url);
+ /* printf ("new url: %s\n", url); */
g_free (url);
}
}