[geany/geany-plugins] 0e2926: Set the Tasks addon only to active if it is actually enabled

Enrico Tröger git-noreply at xxxxx
Sun Oct 19 15:53:07 UTC 2014


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 19 Oct 2014 15:53:07 UTC
Commit:      0e292667264f188a48f689772fe2dccbcbf97af3
             https://github.com/geany/geany-plugins/commit/0e292667264f188a48f689772fe2dccbcbf97af3

Log Message:
-----------
Set the Tasks addon only to active if it is actually enabled

And still add some more guards to the "is active" checks to ensure
the addon is enabled at all.
Otherwise the addon tries to update the task list which does not
even exist.


Modified Paths:
--------------
    addons/src/ao_tasks.c

Modified: addons/src/ao_tasks.c
13 lines changed, 8 insertions(+), 5 deletions(-)
===================================================================
@@ -504,7 +504,7 @@ void ao_tasks_remove(AoTasks *t, GeanyDocument *cur_doc)
 	GtkTreeIter iter;
 	gchar *filename;
 
-	if (! priv->active)
+	if (! priv->active || ! priv->enable_tasks)
 		return;
 
 	if (gtk_tree_model_get_iter_first(model, &iter))
@@ -600,7 +600,7 @@ void ao_tasks_update_single(AoTasks *t, GeanyDocument *cur_doc)
 {
 	AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
 
-	if (! priv->active)
+	if (! priv->active || ! priv->enable_tasks)
 		return;
 
 	if (! priv->scan_all_documents)
@@ -651,9 +651,12 @@ static gboolean ao_tasks_select_task(GtkTreeModel *model, GtkTreePath *path,
 void ao_tasks_set_active(AoTasks *t)
 {
 	AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
-	priv->active = TRUE;
 
-	ao_tasks_update(t, NULL);
+	if (priv->enable_tasks)
+	{
+		priv->active = TRUE;
+		ao_tasks_update(t, NULL);
+	}
 }
 
 
@@ -661,7 +664,7 @@ void ao_tasks_update(AoTasks *t, GeanyDocument *cur_doc)
 {
 	AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
 
-	if (! priv->active)
+	if (! priv->active || ! priv->enable_tasks)
 		return;
 
 	if (! priv->scan_all_documents && cur_doc == NULL)



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list