[evolution-patches] 73550, disabled plugin interfering with mail





this makes the 'enable plugin' stuff a bit more complete, for formatters and for config pages

Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.529
diff -u -p -r1.529 ChangeLog
--- e-util/ChangeLog	4 Mar 2005 03:07:18 -0000	1.529
+++ e-util/ChangeLog	14 Mar 2005 09:44:19 -0000
@@ -1,3 +1,11 @@
+2005-03-14  Not Zed  <NotZed Ximian com>
+
+	** See bug #73550 (related for config pages)
+
+	* e-config.c (ech_config_widget_factory): if we are disabled, then
+	noop.
+	(ech_config_factory, ech_commit, ech_abort): same.
+
 2005-03-01  Not Zed  <NotZed Ximian com>
 
 	* *.c: Remove/disable debug.
Index: e-util/e-config.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-config.c,v
retrieving revision 1.18
diff -u -p -r1.18 e-config.c
--- e-util/e-config.c	21 Feb 2005 06:36:55 -0000	1.18
+++ e-util/e-config.c	14 Mar 2005 09:44:19 -0000
@@ -1244,7 +1244,7 @@ ech_commit(EConfig *ec, GSList *items, v
 {
 	struct _EConfigHookGroup *group = data;
 
-	if (group->commit)
+	if (group->commit && group->hook->hook.plugin->enabled)
 		e_plugin_invoke(group->hook->hook.plugin, group->commit, ec->target);
 }
 
@@ -1253,7 +1253,7 @@ ech_abort(EConfig *ec, GSList *items, vo
 {
 	struct _EConfigHookGroup *group = data;
 
-	if (group->abort)
+	if (group->abort && group->hook->hook.plugin->enabled)
 		e_plugin_invoke(group->hook->hook.plugin, group->abort, ec->target);
 }
 
@@ -1280,7 +1280,8 @@ ech_config_factory(EConfig *emp, void *d
 
 	d(printf("config factory called %s\n", group->id?group->id:"all menus"));
 
-	if (emp->target->type != group->target_type)
+	if (emp->target->type != group->target_type
+	    || !group->hook->hook.plugin->enabled)
 		return;
 
 	if (group->items)
@@ -1313,15 +1314,19 @@ static struct _GtkWidget *
 ech_config_widget_factory(EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, void *data)
 {
 	struct _EConfigHookGroup *group = data;
-	EConfigHookItemFactoryData hdata;
 
-	hdata.config = ec;
-	hdata.item = item;
-	hdata.target = ec->target;
-	hdata.parent = parent;
-	hdata.old = old;
+	if (group->hook->hook.plugin->enabled) {
+		EConfigHookItemFactoryData hdata;
 
-	return (struct _GtkWidget *)e_plugin_invoke(group->hook->hook.plugin, (char *)item->user_data, &hdata);
+		hdata.config = ec;
+		hdata.item = item;
+		hdata.target = ec->target;
+		hdata.parent = parent;
+		hdata.old = old;
+
+		return (struct _GtkWidget *)e_plugin_invoke(group->hook->hook.plugin, (char *)item->user_data, &hdata);
+	} else
+		return NULL;
 }
 
 static struct _EConfigItem *
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3604
diff -u -p -r1.3604 ChangeLog
--- mail/ChangeLog	11 Mar 2005 01:27:27 -0000	1.3604
+++ mail/ChangeLog	14 Mar 2005 09:44:23 -0000
@@ -1,3 +1,10 @@
+2005-03-14  Not Zed  <NotZed Ximian com>
+
+	** See bug #73550
+
+	* em-format-hook.c (emfh_format_format): if we are disabled, don't
+	invoke handler, try to invoke old handler if there was one.
+
 2005-03-10  Not Zed  <NotZed Ximian com>
 
 	** See bug #73293
Index: mail/em-format-hook.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-hook.c,v
retrieving revision 1.5
diff -u -p -r1.5 em-format-hook.c
--- mail/em-format-hook.c	27 Jan 2005 18:00:30 -0000	1.5
+++ mail/em-format-hook.c	14 Mar 2005 09:44:23 -0000
@@ -69,11 +69,16 @@ static void
 emfh_format_format(EMFormat *md, struct _CamelStream *stream, struct _CamelMimePart *part, const EMFormatHandler *info)
 {
 	struct _EMFormatHookItem *item = (EMFormatHookItem *)info;
-	EMFormatHookTarget target = {
-		md, stream, part, item
-	};
 
-	e_plugin_invoke(item->hook->hook.plugin, item->format, &target);
+	if (item->hook->hook.plugin->enabled) {
+		EMFormatHookTarget target = {
+			md, stream, part, item
+		};
+
+		e_plugin_invoke(item->hook->hook.plugin, item->format, &target);
+	} else if (info->old) {
+		info->old->handler(md, stream, part, info->old);
+	}
 }
 
 static void
@@ -180,6 +185,8 @@ emfh_construct(EPluginHook *eph, EPlugin
 					for (;l;l=g_slist_next(l)) {
 						EMFormatHookItem *item = l->data;
 						/* TODO: only add handlers if enabled? */
+						/* Well, disabling is handled by the callback, if we leave as is,
+						   then we can enable the plugin after startup and it will start working automagically */
 						em_format_class_add_handler(klass, &item->handler);
 					}
 				}


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