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



I still haven't heard back regarding this patch, nor have I received
any reply from two emails to Jeffrey in Nov and Dec.

I've updated the patch again (attached) to apply cleanly to CVS HEAD.

It'd be great if someone could finally commit it (or at least respond).

peace,
Jason

-------- Forwarded Message --------
From: Jason Hildebrand <jason peaceworks ca>
To: Jeffrey Stedfast <fejj ximian com>
Cc: evolution-patches lists ximian com
Subject: Re: [evolution-patches] Bug 21974: Make editor component configurable
Date: Mon, 08 Nov 2004 16:53:58 -0600
Hi Jeff,

I've made the modifications you suggested; the updated patch is attached.

peace,
Jason

On Mon, 2004-11-08 at 14:50 -0500, Jeffrey Stedfast wrote:
> a few comments below.

> Jeff

> On Sun, 2004-11-07 at 13:34 -0600, Jason Hildebrand wrote:
> > Hi Jeffrey,
> >
> > I submitted this patch way back prior to the Evo 2.0 freeze.  It makes
> > it
> > possible to use an alternate editor instead of GtkHTML by setting
> > the /apps/evolution/mail/composer/editor_oafiid gconf key.
> >
> > The patch was reviewed at that time, but didn't actually get committed
> > before
> > the freeze.
> >
> > I've just updated it to apply cleanly to CVS head, and have compiled
> > and
> > tested it, and would appreciate it if you could review/commit it now.
> >
> > peace,
> > Jason
> >
> >
> >
> >
> >
> >
> >
> > text/x-patch
> > attachment
> > (gconf-editor-oafiid.patch)
> >
> > Index: composer/ChangeLog
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
> > retrieving revision 1.669
> > diff -u -p -r1.669 ChangeLog
> > --- composer/ChangeLog  28 Oct 2004 09:25:47 -0000      1.669
> > +++ composer/ChangeLog  7 Nov 2004 19:23:11 -0000
> > @@ -1,3 +1,9 @@
> > +2004-11-07  Jason Hildebrand <jason peaceworks ca>
> > +
> > +    * e-msg-composer.c:
> > use /apps/evolution/mail/composer/editor_oafiid
> > +    gconf key to get oafiid of editor component to use.  Fallback to
> > +    using GtkHTML if there are any errors instantiating the editor.
> > +
> >  2004-10-28  Not Zed  <NotZed Ximian com>
> >
> >         * e-msg-composer.c (drag_data_received): fix the popup id.
> > Index: composer/e-msg-composer.c
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
> > retrieving revision 1.490
> > diff -u -p -r1.490 e-msg-composer.c
> > --- composer/e-msg-composer.c   28 Oct 2004 09:25:47 -0000      1.490
> > +++ composer/e-msg-composer.c   7 Nov 2004 19:23:16 -0000
> > @@ -2517,6 +2517,8 @@ composer_finalise (GObject *object)
> >         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);
> > @@ -3077,6 +3079,7 @@ static void
> >  e_msg_composer_load_config (EMsgComposer *composer, int visible_mask)
> >  {
> >         GConfClient *gconf;
> > +       GError *err = NULL;
> >
> >         gconf = gconf_client_get_default ();
> >
> > @@ -3094,6 +3097,17 @@ e_msg_composer_load_config (EMsgComposer
> >                 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",
> > &err);
> > +       /* if any error occurs reading the editor key, or if key is
> > empty, fallback to GtkHTML */
> > +       if (err || composer->editor_oafiid == NULL || !
> > composer->editor_oafiid[0]) {

> I don't think you should check err NULLness here, you accomplish the
> same with checking the return value of the oafiid.

> > +        if (composer->editor_oafiid) {
> > +            g_free (composer->editor_oafiid);
> > +        }

> just g_free (composer->editor_oafiid);

> no need to check non-NULL first. Also, for style - don't use braces if
> there is only one statement to call.

> > +               composer->editor_oafiid = g_strdup
> > (GNOME_GTKHTML_EDITOR_CONTROL_ID);
> > +               g_error_free (err);

> since you don't actually use err, why even bother having it?

> > +       }
> > +       composer->catch_escape = TRUE;
> >
> >         /* if we're mailing, you cannot disable to so it should appear
> > checked */
> >         if (visible_mask & E_MSG_COMPOSER_VISIBLE_TO)
> > @@ -3202,7 +3216,7 @@ msg_composer_destroy_notify (void *data)
> >  static int
> >  composer_key_pressed (EMsgComposer *composer, GdkEventKey *event,
> > void *user_data)
> >  {
> > -       if (event->keyval == GDK_Escape) {
> > +       if (event->keyval == GDK_Escape && composer->catch_escape) {
> >                 do_exit (composer);
> >                 g_signal_stop_emission_by_name (composer,
> > "key-press-event");
> >                 return TRUE;
> > @@ -3325,6 +3339,7 @@ create_composer (int visible_mask)
> >         GList *icon_list;
> >         BonoboControlFrame *control_frame;
> >         GdkPixbuf *attachment_pixbuf;
> > +       gboolean editor_needs_escape = FALSE;
> >
> >         composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name",
> > _("Compose a message"), NULL);
> >         gtk_window_set_title ((GtkWindow *) composer, _("Compose a
> > message"));
> > @@ -3380,8 +3395,18 @@ create_composer (int visible_mask)
> >
> >         /* Editor component.  */
> >         composer->editor = bonobo_widget_new_control (
> > -               GNOME_GTKHTML_EDITOR_CONTROL_ID,
> > +               composer->editor_oafiid,
> >                 bonobo_ui_component_get_container (composer->uic));
> > +
> > +       /* if activation of alternate editor failed, try falling back
> > to the GtkHTML editor */
> > +       if (!composer->editor && composer->editor_oafiid && strcmp
> > (GNOME_GTKHTML_EDITOR_CONTROL_ID, composer->editor_oafiid)) {
> > +               composer->editor = bonobo_widget_new_control (
> > +                       GNOME_GTKHTML_EDITOR_CONTROL_ID,
> > +                       bonobo_ui_component_get_container
> > (composer->uic));
> > +       }
> > +
> > +       /* if activation still failed, display the error message from
> > the
> > +        * _original_ activation attempt. */
> >         if (!composer->editor) {
> >                 e_error_run (GTK_WINDOW (composer),
> > "mail-composer:no-editor-control", NULL);
> >                 gtk_object_destroy (GTK_OBJECT (composer));
> > @@ -3494,6 +3519,9 @@ create_composer (int visible_mask)
> >                 am = autosave_manager_new ();
> >
> >         autosave_manager_register (am, composer);
> > +
> > +       bonobo_widget_get_property (BONOBO_WIDGET (composer->editor),
> > "EditorNeedsEscape", TC_CORBA_boolean, &editor_needs_escape, NULL);
> > +       composer->catch_escape = !editor_needs_escape;
> >
> >         composer->has_changed = FALSE;
> >
> > Index: composer/e-msg-composer.h
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/composer/e-msg-composer.h,v
> > retrieving revision 1.91
> > diff -u -p -r1.91 e-msg-composer.h
> > --- composer/e-msg-composer.h   27 Jul 2004 16:52:17 -0000      1.91
> > +++ composer/e-msg-composer.h   7 Nov 2004 19:23:17 -0000
> > @@ -74,6 +74,8 @@ struct _EMsgComposer {
> >
> >         GtkWidget *address_dialog;
> >
> > +       char                    *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.3493
> > diff -u -p -r1.3493 ChangeLog
> > --- mail/ChangeLog      3 Nov 2004 09:47:23 -0000       1.3493
> > +++ mail/ChangeLog      7 Nov 2004 19:23:27 -0000
> > @@ -1,3 +1,11 @@
> > +2004-11-07  Jason Hildebrand <jason peaceworks ca>
> > +
> > +    * evolution-mail.schemas.in.in: added
> > +    /apps/evolution/mail/composer/editor_oafiid gconf key which can
> > +    be used to specify an alternate editor component.  If empty or
> > +    invalid, GtkHTML is used.
> > +
> > +
> >  2004-11-03  Not Zed  <NotZed Ximian com>
> >
> >         * em-folder-view.c (emfv_popup): Fix the popup id.
> > Index: mail/evolution-mail.schemas.in.in
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/mail/evolution-mail.schemas.in.in,v
> > retrieving revision 1.17
> > diff -u -p -r1.17 evolution-mail.schemas.in.in
> > --- mail/evolution-mail.schemas.in.in   10 May 2004 19:35:38
> > -0000      1.17
> > +++ mail/evolution-mail.schemas.in.in   7 Nov 2004 19:23:28 -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></default>
> > +      <locale name="C">
> > +         <short>Activation ID (OAFIID) 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

Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.677
diff -u -r1.677 ChangeLog
--- composer/ChangeLog	24 Dec 2004 13:57:49 -0000	1.677
+++ composer/ChangeLog	6 Jan 2005 03:25:49 -0000
@@ -1,3 +1,9 @@
+2005-01-05  Jason Hildebrand <jason peaceworks ca>
+
+    * e-msg-composer.c: use /apps/evolution/mail/composer/editor_oafiid 
+    gconf key to get oafiid of editor component to use.  Fallback to
+    using GtkHTML if there are any errors instantiating the editor.
+
 2004-12-24  JP Rosevear  <jpr novell com>
 
 	* e-msg-composer.c (setup_signatures_menu): kill warnings
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.495
diff -u -r1.495 e-msg-composer.c
--- composer/e-msg-composer.c	24 Dec 2004 13:57:49 -0000	1.495
+++ composer/e-msg-composer.c	6 Jan 2005 03:25:54 -0000
@@ -2518,6 +2518,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);
@@ -3095,6 +3097,14 @@
 		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 any error occurs reading the editor key, or if key is empty, fallback to GtkHTML */
+	if (composer->editor_oafiid == NULL || !composer->editor_oafiid[0]) {
+        g_free (composer->editor_oafiid);
+		composer->editor_oafiid = g_strdup (GNOME_GTKHTML_EDITOR_CONTROL_ID);
+	}
+	composer->catch_escape = TRUE;
 	
 	/* if we're mailing, you cannot disable to so it should appear checked */
 	if (visible_mask & E_MSG_COMPOSER_VISIBLE_TO)
@@ -3196,7 +3206,7 @@
 static int
 composer_key_pressed (EMsgComposer *composer, GdkEventKey *event, void *user_data)
 {
-	if (event->keyval == GDK_Escape) {
+	if (event->keyval == GDK_Escape && composer->catch_escape) {
 		do_exit (composer);
 		g_signal_stop_emission_by_name (composer, "key-press-event");
 		return TRUE;
@@ -3318,6 +3328,7 @@
 	int vis;
 	GList *icon_list;
 	BonoboControlFrame *control_frame;
+	gboolean editor_needs_escape = FALSE;
 	
 	composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL);
 	gtk_window_set_title ((GtkWindow *) composer, _("Compose a message"));
@@ -3373,8 +3384,16 @@
 
 	/* Editor component.  */
 	composer->editor = bonobo_widget_new_control (
-		GNOME_GTKHTML_EDITOR_CONTROL_ID,
+		composer->editor_oafiid,
 		bonobo_ui_component_get_container (composer->uic));
+
+ 	/* if activation of alternate editor failed, try falling back to the GtkHTML editor */
+ 	if (!composer->editor && composer->editor_oafiid && strcmp (GNOME_GTKHTML_EDITOR_CONTROL_ID, composer->editor_oafiid))
+ 		composer->editor = bonobo_widget_new_control (
+ 			GNOME_GTKHTML_EDITOR_CONTROL_ID,
+ 			bonobo_ui_component_get_container (composer->uic));
+
+ 	/* if activation still failed, display an error message */
 	if (!composer->editor) {
 		e_error_run (GTK_WINDOW (composer), "mail-composer:no-editor-control", NULL);
 		gtk_object_destroy (GTK_OBJECT (composer));
@@ -3485,6 +3504,9 @@
 		am = autosave_manager_new ();
 	
 	autosave_manager_register (am, composer);
+
+	bonobo_widget_get_property (BONOBO_WIDGET (composer->editor), "EditorNeedsEscape", TC_CORBA_boolean, &editor_needs_escape, NULL);
+	composer->catch_escape = !editor_needs_escape;
 
 	composer->has_changed = FALSE;
 	
Index: composer/e-msg-composer.h
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.h,v
retrieving revision 1.91
diff -u -r1.91 e-msg-composer.h
--- composer/e-msg-composer.h	27 Jul 2004 16:52:17 -0000	1.91
+++ composer/e-msg-composer.h	6 Jan 2005 03:25:54 -0000
@@ -74,6 +74,8 @@
 	
 	GtkWidget *address_dialog;
 	
+	char                    *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.3519
diff -u -r1.3519 ChangeLog
--- mail/ChangeLog	22 Dec 2004 07:38:16 -0000	1.3519
+++ mail/ChangeLog	6 Jan 2005 03:26:04 -0000
@@ -1,3 +1,10 @@
+2005-01-05  Jason Hildebrand <jason peaceworks ca>
+
+    * evolution-mail.schemas.in.in: added 
+    /apps/evolution/mail/composer/editor_oafiid gconf key which can
+    be used to specify an alternate editor component.  If empty or 
+    invalid, GtkHTML is used.
+
 2004-12-22  Not Zed  <NotZed Ximian com>
 
 	* em-account-editor.c (emae_needs_auth): moved to after
Index: mail/evolution-mail.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/mail/evolution-mail.schemas.in.in,v
retrieving revision 1.17
diff -u -r1.17 evolution-mail.schemas.in.in
--- mail/evolution-mail.schemas.in.in	10 May 2004 19:35:38 -0000	1.17
+++ mail/evolution-mail.schemas.in.in	6 Jan 2005 03:26:05 -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></default>
+      <locale name="C">
+         <short>Activation ID (OAFIID) 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]