| [cairo-compmgr] wrong plugin dependencies | 
[ Thread Index | 
Date Index
| More lists.tuxfamily.org/cairo-compmgr Archives
] 
- To: cairo-compmgr@xxxxxxxxxxxxxxxxxxx
 
- Subject: [cairo-compmgr] wrong plugin dependencies
 
- From: "Carlos Diógenes" <cerdiogenes@xxxxxxxxx>
 
- Date: Thu, 24 Jan 2008 20:23:24 -0200
 
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;         d=gmail.com; s=gamma;         h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=Opj9crFwFLrKR77F2O+2KStLmNYt4OX9j6P8bpXcGUk=;         b=wGTuZyOn0Ge51shOUnTYKC9oBK4eK3uUz/XVRvNjFO4Z7GdVSHwkktso51c53tEaWw9fnxwUfowM0Pt/MPzfQObQ1Ykv4iamojnKSlbChqKWm/4ZJopHp/20/SJomk/YsvtXRpuEbow7wvm+ssHZsHIDCQ9Ab0I7WdZ6ZRB98Sc=
 
- Domainkey-signature: a=rsa-sha1; c=nofws;         d=gmail.com; s=gamma;    h=message-id:date:from:to:subject:mime-version:content-type;          b=ZbgiEQ2R9BivUH1H406VlD/WyUrZKmrNa6F6V730UPn3Aagf5Q6/9RBkIzPxjFl72t+P3gwcAunWzmSJcj2pSO3fAdhAF5nHJcIfLFDX2Fnogko6DGO5IFqB7UFFXRt7dRQhwdHKBn7a7ikz2884cj+Jl9afyiddnqHqjtLDovI=
 
Hi,
In the actual code the plugin dependence is not done right. For
example, suppose that we have a plugin called "Swellow" that depends
upon (loads after) the "Magnifier" plugin, so if we have the following
plugins entering the system, the other will be wrong:
1. Magnifier
2. Menu Animation
3 .Swellow
Since the load order will be: Swellow, Menu Animation and Magnifier,
instead of Menu Animation, Magnifier and Swellow.
The attached patch correct the problem.
Best regards,
Carlos.
diff --git a/plugins/magnifier/ccm-magnifier.c b/plugins/magnifier/ccm-magnifier.c
diff --git a/plugins/magnifier/ccm-magnifier.plugin.desktop.in b/plugins/magnifier/ccm-magnifier.plugin.desktop.in
index adf9ea0..bb2bf62 100644
--- a/plugins/magnifier/ccm-magnifier.plugin.desktop.in
+++ b/plugins/magnifier/ccm-magnifier.plugin.desktop.in
@@ -3,4 +3,4 @@ Plugin=ccm-magnifier
 _Name=Magnifier
 _Description=Cairo Composite Manager Magnifier
 Backends=xrender;glitz
-Depends=
+Depends=Shadow
diff --git a/plugins/shadow/ccm-shadow.c b/plugins/shadow/ccm-shadow.c
diff --git a/plugins/shadow/ccm-shadow.plugin.desktop.in b/plugins/shadow/ccm-shadow.plugin.desktop.in
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
diff --git a/src/ccm-extension-loader.c b/src/ccm-extension-loader.c
index e325200..564b462 100644
--- a/src/ccm-extension-loader.c
+++ b/src/ccm-extension-loader.c
@@ -94,9 +94,8 @@ ccm_extension_loader_new ()
 					
 					if ((plugin = ccm_extension_new(file)) != NULL)
 					{
-						self->priv->plugins = g_slist_insert_sorted (
-										self->priv->plugins, plugin,
-										(GCompareFunc)_ccm_extension_compare);
+						_ccm_extension_insert_sorted (&self->priv->plugins,
+													  plugin);
 					}
 					g_free(file);
 				}
diff --git a/src/ccm-extension.c b/src/ccm-extension.c
index 852fed1..1524f9f 100644
--- a/src/ccm-extension.c
+++ b/src/ccm-extension.c
@@ -239,6 +239,30 @@ ccm_extension_get_type_object (CCMExtension* self)
 	return self->priv->type;
 }
 
+void
+_ccm_extension_insert_sorted (GSList** self, CCMExtension* in)
+
+{
+	gint most_far = -1;
+	int cpt;
+	GSList *tmp;
+
+	tmp = *self;
+
+	while (tmp) {
+		CCMExtension *on = CCM_EXTENSION (tmp->data);
+		for (cpt = 0; in->priv->depends[cpt]; cpt++) {
+			if (!g_ascii_strcasecmp (in->priv->depends[cpt],
+									 on->priv->label)) {
+				most_far = g_slist_index (*self, on);
+			}
+		}
+		tmp = tmp->next;
+	}
+
+	*self = g_slist_insert (*self, in, most_far + 1);
+}
+
 gint
 _ccm_extension_compare(CCMExtension* self, CCMExtension* other)
 {
diff --git a/src/ccm-extension.h b/src/ccm-extension.h
index ee363d5..de402da 100644
--- a/src/ccm-extension.h
+++ b/src/ccm-extension.h
@@ -58,6 +58,8 @@ GType 			ccm_extension_get_type_object 	(CCMExtension* self);
 const gchar*	ccm_extension_get_label			(CCMExtension* self);
 gint			_ccm_extension_compare			(CCMExtension* self, 
 												 CCMExtension* other);
+void            _ccm_extension_insert_sorted    (GSList** self,
+												 CCMExtension* in);
 
 G_END_DECLS