[evolution-patches] Bug 21974: Make editor component configurable



Attached is a patch which allows the use of alternate editors.  The composer
gets the OAFIID of the editor component to be used from a gconf key.  

Also, if the current editor is Vim, the composer does not catch the 'ESC'
keypresses as it normally does, because Vim needs this key.

thanks,
Jason
? .swo
? .swp
? excludelist
? gconf-editor-key
? addressbook/gui/component/apps_evolution_addressbook-1.5.schemas
? calendar/common/Makefile
? calendar/common/Makefile.in
? calendar/gui/apps_evolution_calendar-1.5.schemas
? composer/.e-msg-composer.c.swp
? composer/e-msg-composer.c.mine
? composer/e-msg-composer.h.mine
? default_user/local/Makefile
? default_user/local/Makefile.in
? default_user/local/Calendar/Makefile
? default_user/local/Calendar/Makefile.in
? default_user/local/Contacts/Makefile
? default_user/local/Contacts/Makefile.in
? default_user/local/Drafts/Makefile
? default_user/local/Drafts/Makefile.in
? default_user/local/Inbox/Makefile
? default_user/local/Inbox/Makefile.in
? default_user/local/Outbox/Makefile
? default_user/local/Outbox/Makefile.in
? default_user/local/Sent/Makefile
? default_user/local/Sent/Makefile.in
? default_user/local/Tasks/Makefile
? default_user/local/Tasks/Makefile.in
? default_user/local/Trash/Makefile
? default_user/local/Trash/Makefile.in
? mail/evolution-mail-1.5.schemas
? shell/apps_evolution_shell-1.5.schemas
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.591
diff -u -r1.591 ChangeLog
--- composer/ChangeLog	7 Jan 2004 21:11:41 -0000	1.591
+++ composer/ChangeLog	8 Jan 2004 18:15:49 -0000
@@ -1,3 +1,12 @@
+2004-01-08  Jason Hildebrand <jason peaceworks ca>
+
+	* e-msg-composer.c: Get the OAFIID of the editor from a gconf key, so
+	that the user can specify an alternate editor.  If Vim is used as an 
+	editor, don't catch the Escape key.
+	
+	* e-msg-composer.h: Added editor_oafiid and catch_escape attributes to
+	EMsgComposer.
+
 2004-01-07  Jeffrey Stedfast  <fejj ximian com>
 
 	* e-msg-composer.c (create_composer): Remove the 6-pixel border
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.426
diff -u -r1.426 e-msg-composer.c
--- composer/e-msg-composer.c	7 Jan 2004 21:11:41 -0000	1.426
+++ composer/e-msg-composer.c	8 Jan 2004 18:15:52 -0000
@@ -107,8 +107,6 @@
 #include "Editor.h"
 #include "listener.h"
 
-#define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor:3.1"
-
 #define d(x) x
 
 
@@ -2399,6 +2397,8 @@
 	g_hash_table_destroy (composer->inline_images);
 	g_hash_table_destroy (composer->inline_images_by_url);
 	
+	g_free (composer->editor_oafiid);
+
 	g_free (composer->charset);
 	g_free (composer->mime_type);
 	g_free (composer->mime_body);
@@ -2734,6 +2734,11 @@
 		gconf, "/apps/evolution/mail/composer/view/Bcc", NULL);
 	composer->view_subject = gconf_client_get_bool (
 		gconf, "/apps/evolution/mail/composer/view/Subject", NULL);
+	composer->editor_oafiid = gconf_client_get_string (
+		gconf, "/apps/evolution/mail/composer/editor_oafiid", NULL);
+	/* if editor is Vim, don't catch the Escape key because Vim needs it */
+	if (composer->editor_oafiid && !strcmp(composer->editor_oafiid, "OAFIID:Vim_Control"))
+		composer->catch_escape = FALSE;
 	
 	g_object_unref (gconf);
 }
@@ -2819,7 +2824,9 @@
 static int
 composer_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 {
-	if (event->keyval == GDK_Escape) {
+	EMsgComposer *composer = E_MSG_COMPOSER (widget);
+
+	if (event->keyval == GDK_Escape && composer->catch_escape) {
 		do_exit (E_MSG_COMPOSER (widget));
 		
 		g_signal_stop_emission_by_name (widget, "key-press-event");
@@ -2983,15 +2990,15 @@
 
 	/* Editor component.  */
 	composer->editor = bonobo_widget_new_control (
-		GNOME_GTKHTML_EDITOR_CONTROL_ID,
+		composer->editor_oafiid,
 		bonobo_ui_component_get_container (composer->uic));
 	if (!composer->editor) {
 		e_activation_failure_dialog (GTK_WINDOW (composer),
 					     _("Could not create composer window:\n"
-					       "Unable to activate HTML editor component.\n"
+					       "Unable to activate editor component.\n"
 					       "Please make sure you have the correct version\n"
-					       "of gtkhtml and libgtkhtml installed.\n"),
-					     GNOME_GTKHTML_EDITOR_CONTROL_ID,
+					       "of the editor installed (normally gtkhtml and libgtkhtml).\n"),
+					     composer->editor_oafiid,
 					     "IDL:Bonobo/Control:1.0");
 		gtk_object_destroy (GTK_OBJECT (composer));
 		return NULL;
@@ -3058,8 +3065,8 @@
 	if (composer->editor_engine == CORBA_OBJECT_NIL) {
 		e_activation_failure_dialog (GTK_WINDOW (composer),
 					     _("Could not create composer window:\n"
-					       "Unable to activate HTML editor component."),
-					     GNOME_GTKHTML_EDITOR_CONTROL_ID,
+					       "Unable to activate editor component."),
+					     composer->editor_oafiid,
 					     "IDL:GNOME/GtkHTML/Editor/Engine:1.0");
 		gtk_object_destroy (GTK_OBJECT (composer));
 		return NULL;
Index: composer/e-msg-composer.h
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.h,v
retrieving revision 1.86
diff -u -r1.86 e-msg-composer.h
--- composer/e-msg-composer.h	1 Dec 2003 15:20:49 -0000	1.86
+++ composer/e-msg-composer.h	8 Jan 2004 18:15:53 -0000
@@ -72,6 +72,8 @@
 	
 	GtkWidget *address_dialog;
 	
+	gchar                   *editor_oafiid;
+	gboolean                 catch_escape;
 	Bonobo_PersistFile       persist_file_interface;
 	Bonobo_PersistStream     persist_stream_interface;
 	GNOME_GtkHTML_Editor_Engine  editor_engine;
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2977
diff -u -r1.2977 ChangeLog
--- mail/ChangeLog	7 Jan 2004 22:12:40 -0000	1.2977
+++ mail/ChangeLog	8 Jan 2004 18:15:56 -0000
@@ -1,3 +1,9 @@
+2004-01-08  Jason Hildebrand <jason peaceworks ca>
+
+	* evolution-mail.schemas.in.in: Added 
+	/schemas/apps/evolution/mail/composer/editor_oafiid key to let user 
+	override editor component.
+
 2004-01-07  Jeffrey Stedfast  <fejj ximian com>
 
 	* mail-component.c (mail_component_init): Don't migrate stuff here
Index: mail/evolution-mail.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/mail/evolution-mail.schemas.in.in,v
retrieving revision 1.3
diff -u -r1.3 evolution-mail.schemas.in.in
--- mail/evolution-mail.schemas.in.in	11 Dec 2003 04:56:12 -0000	1.3
+++ mail/evolution-mail.schemas.in.in	8 Jan 2004 18:15:57 -0000
@@ -74,6 +74,21 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/evolution/mail/composer/editor_oafiid</key>
+      <applyto>/apps/evolution/mail/composer/editor_oafiid</applyto>
+      <owner>evolution-mail</owner>
+      <type>string</type>
+      <default>OAFIID:GNOME_GtkHTML_Editor:3.1</default>
+      <locale name="C">
+         <short>Activation ID of editor control.</short>
+         <long>
+          Evolution uses the GtkHTML editor by default.  Change this
+          ID to use an alternate (compatible) editor.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/evolution/mail/composer/view/From</key>
       <applyto>/apps/evolution/mail/composer/view/From</applyto>
       <owner>evolution-mail</owner>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]