evolution r34974 - branches/mbarnes-composer/composer
- From: mbarnes svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r34974 - branches/mbarnes-composer/composer
- Date: Fri, 8 Feb 2008 01:11:47 +0000 (GMT)
Author: mbarnes
Date: Fri Feb 8 01:11:46 2008
New Revision: 34974
URL: http://svn.gnome.org/viewvc/evolution?rev=34974&view=rev
Log:
Port a few more editing functions over to the GtkhtmlEditor API.
Modified:
branches/mbarnes-composer/composer/e-msg-composer.c
Modified: branches/mbarnes-composer/composer/e-msg-composer.c
==============================================================================
--- branches/mbarnes-composer/composer/e-msg-composer.c (original)
+++ branches/mbarnes-composer/composer/e-msg-composer.c Fri Feb 8 01:11:46 2008
@@ -5119,21 +5119,13 @@
gboolean
e_msg_composer_is_dirty (EMsgComposer *composer)
{
-#if 0 /* GTKHTML-EDITOR */
- EMsgComposerPrivate *p = composer->priv;
- CORBA_Environment ev;
- gboolean rv;
-
- CORBA_exception_init (&ev);
- rv = p->has_changed
- || (GNOME_GtkHTML_Editor_Engine_hasUndo (p->eeditor_engine, &ev) &&
- !GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "is-saved", &ev));
- CORBA_exception_free (&ev);
+ GtkhtmlEditor *editor;
- return rv;
-#endif /* GTKHTML-EDITOR */
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
- return TRUE;
+ return composer->priv->has_changed ||
+ (gtkhtml_editor_has_undo (editor) &&
+ !gtkhtml_editor_run_command (editor, "is-saved"));
}
/**
@@ -5315,117 +5307,96 @@
void
e_msg_composer_reply_indent (EMsgComposer *composer)
{
-#if 0 /* GTKHTML-EDITOR */
- EMsgComposerPrivate *p = composer->priv;
- CORBA_Environment ev;
+ GtkhtmlEditor *editor;
+
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- CORBA_exception_init (&ev);
+ editor = GTKHTML_EDITOR (composer);
- if (!GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (p->eeditor_engine, &ev)) {
- if (GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty (p->eeditor_engine, &ev))
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "cursor-backward", &ev);
+ if (!gtkhtml_editor_is_paragraph_empty (editor)) {
+ if (gtkhtml_editor_is_previous_paragraph_empty (editor))
+ gtkhtml_editor_run_command (editor, "cursor-backward");
else {
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "text-default-color", &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "insert-paragraph", &ev);
+ gtkhtml_editor_run_command (editor, "text-default-color");
+ gtkhtml_editor_run_command (editor, "italic-off");
+ gtkhtml_editor_run_command (editor, "insert-paragraph");
return;
}
}
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "style-normal", &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "indent-zero", &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "text-default-color", &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev);
-
- CORBA_exception_free (&ev);
-#endif /* GTKHTML-EDITOR */
+ gtkhtml_editor_run_command (editor, "style-normal");
+ gtkhtml_editor_run_command (editor, "indent-zero");
+ gtkhtml_editor_run_command (editor, "text-default-color");
+ gtkhtml_editor_run_command (editor, "italic-off");
}
void
e_msg_composer_insert_paragraph_before (EMsgComposer *composer)
{
-#if 0 /* GTKHTML-EDITOR */
- EMsgComposerPrivate *p = composer->priv;
- CORBA_Environment ev;
+ GtkhtmlEditor *editor;
+ const gchar *data;
- CORBA_exception_init (&ev);
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- if (!p->in_signature_insert) {
- CORBA_char *orig, *signature;
- gboolean changed = FALSE;
- /* FIXME check for insert-paragraph command */
-
- orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "orig", &ev);
- if (ev._major == CORBA_NO_EXCEPTION) {
- if (orig && *orig == '1') {
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "text-default-color", &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev);
- changed = TRUE;
- }
- CORBA_free (orig);
- }
- if (!changed) {
- signature = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "signature", &ev);
- if (ev._major == CORBA_NO_EXCEPTION) {
- if (signature && *signature == '1') {
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "text-default-color",
- &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev);
- }
- CORBA_free (signature);
- }
- }
- }
+ if (composer->priv->in_signature_insert)
+ return;
+
+ editor = GTKHTML_EDITOR (composer);
+
+ data = gtkhtml_editor_get_paragraph_data (editor, "orig");
+ if (data != NULL && *data == '1') {
+ gtkhtml_editor_run_command (editor, "text-default-color");
+ gtkhtml_editor_run_command (editor, "italic-off");
+ return;
+ };
- CORBA_exception_free (&ev);
-#endif /* GTKHTML-EDITOR */
+ data = gtkhtml_editor_get_paragraph_data (editor, "signature");
+ if (data != NULL && *data == '1') {
+ gtkhtml_editor_run_command (editor, "text-default-color");
+ gtkhtml_editor_run_command (editor, "italic-off");
+ }
}
static void
-clear_signature (GNOME_GtkHTML_Editor_Engine e, CORBA_Environment * ev)
+clear_signature (GtkhtmlEditor *editor)
{
- 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);
+ if (gtkhtml_editor_is_paragraph_empty (editor))
+ gtkhtml_editor_set_paragraph_data (editor, "signature" ,"0");
+
+ else if (gtkhtml_editor_is_previous_paragraph_empty (editor) &&
+ gtkhtml_editor_run_command (editor, "cursor-backward")) {
+
+ gtkhtml_editor_set_paragraph_data (editor, "signature", "0");
+ gtkhtml_editor_run_command (editor, "cursor-forward");
}
- GNOME_GtkHTML_Editor_Engine_runCommand (e, "text-default-color", ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (e, "italic-off", ev);
+
+ gtkhtml_editor_run_command (editor, "text-default-color");
+ gtkhtml_editor_run_command (editor, "italic-off");
}
void
e_msg_composer_insert_paragraph_after (EMsgComposer *composer)
{
-#if 0 /* GTKHTML-EDITOR */
- EMsgComposerPrivate *p = composer->priv;
- CORBA_Environment ev;
+ GtkhtmlEditor *editor;
+ const gchar *data;
- CORBA_exception_init (&ev);
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- if (!p->in_signature_insert) {
- CORBA_char *orig, *signature;
- /* FIXME check for insert-paragraph command */
- GNOME_GtkHTML_Editor_Engine_runCommand (p->eeditor_engine, "italic-off", &ev);
-
- orig = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "orig", &ev);
- if (ev._major == CORBA_NO_EXCEPTION) {
- if (orig && *orig == '1')
- e_msg_composer_reply_indent (composer);
- GNOME_GtkHTML_Editor_Engine_setParagraphData (p->eeditor_engine, "orig", "0", &ev);
- CORBA_free (orig);
- }
- signature = GNOME_GtkHTML_Editor_Engine_getParagraphData (p->eeditor_engine, "signature", &ev);
- if (ev._major == CORBA_NO_EXCEPTION) {
- if (signature && *signature == '1')
- clear_signature (p->eeditor_engine, &ev);
- CORBA_free (signature);
- }
- }
+ if (composer->priv->in_signature_insert)
+ return;
+
+ editor = GTKHTML_EDITOR (composer);
- CORBA_exception_free (&ev);
-#endif /* GTKHTML-EDITOR */
+ gtkhtml_editor_run_command (editor, "italic-off");
+
+ data = gtkhtml_editor_get_paragraph_data (editor, "orig");
+ if (data != NULL && *data == '1')
+ e_msg_composer_reply_indent (composer);
+ gtkhtml_editor_set_paragraph_data (editor, "orig", "0");
+
+ data = gtkhtml_editor_get_paragraph_data (editor, "signature");
+ if (data != NULL && *data == '1')
+ clear_signature (editor);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]