SF.net SVN: geany-plugins:[1068] trunk/geany-plugins/addons

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Nov 29 13:40:56 UTC 2009


Revision: 1068
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1068&view=rev
Author:   eht16
Date:     2009-11-29 13:40:56 +0000 (Sun, 29 Nov 2009)

Log Message:
-----------
Update the tasks list on startup only first the main window has been realized, i.e. Geany has finished the startup process.

Modified Paths:
--------------
    trunk/geany-plugins/addons/ChangeLog
    trunk/geany-plugins/addons/src/addons.c
    trunk/geany-plugins/addons/src/ao_tasks.c

Modified: trunk/geany-plugins/addons/ChangeLog
===================================================================
--- trunk/geany-plugins/addons/ChangeLog	2009-11-29 13:08:03 UTC (rev 1067)
+++ trunk/geany-plugins/addons/ChangeLog	2009-11-29 13:40:56 UTC (rev 1068)
@@ -3,6 +3,9 @@
  * src/ao_tasks.c:
    Add a simple popup menu to update the Tasks list and hide
    the Messages window.
+ * src/addons.c, src/ao_tasks.c:
+   Update the tasks list on startup only first the main window has been
+   realized, i.e. Geany has finished the startup process.
 
 
 2009-11-28  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/geany-plugins/addons/src/addons.c
===================================================================
--- trunk/geany-plugins/addons/src/addons.c	2009-11-29 13:08:03 UTC (rev 1067)
+++ trunk/geany-plugins/addons/src/addons.c	2009-11-29 13:40:56 UTC (rev 1068)
@@ -38,7 +38,7 @@
 GeanyFunctions	*geany_functions;
 
 
-PLUGIN_VERSION_CHECK(164)
+PLUGIN_VERSION_CHECK(165)
 PLUGIN_SET_INFO(_("Addons"), _("Various small addons for Geany."), VERSION,
 	"Enrico Tröger, Bert Vermeulen")
 

Modified: trunk/geany-plugins/addons/src/ao_tasks.c
===================================================================
--- trunk/geany-plugins/addons/src/ao_tasks.c	2009-11-29 13:08:03 UTC (rev 1067)
+++ trunk/geany-plugins/addons/src/ao_tasks.c	2009-11-29 13:40:56 UTC (rev 1068)
@@ -54,6 +54,7 @@
 struct _AoTasksPrivate
 {
 	gboolean enable_tasks;
+	gboolean active;
 
 	GtkListStore *store;
 	GtkWidget *tree;
@@ -261,6 +262,20 @@
 }
 
 
+static gboolean update_list_delay(gpointer t)
+{
+	if (main_is_realized())
+	{
+		AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
+		priv->active = TRUE;
+		ao_tasks_update(AO_TASKS(t), NULL);
+		return FALSE;
+	}
+	else
+		return TRUE;
+}
+
+
 static void ao_tasks_show(AoTasks *t)
 {
 	GtkCellRenderer *text_renderer;
@@ -334,7 +349,11 @@
 	priv->popup_menu = create_popup_menu(t);
 
 	/* initial update */
-	ao_tasks_update(t, NULL);
+#if GLIB_CHECK_VERSION(2, 14, 0)
+	g_timeout_add_seconds(3, update_list_delay, t);
+#else
+	g_timeout_add(3, update_list_delay, t);
+#endif
 }
 
 
@@ -362,6 +381,9 @@
 	GeanyDocument *doc;
 	AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
 
+	if (! priv->active)
+		return;
+
 	/* TODO this could be improved to only update the currently loaded/saved document instead of
 	 * iterating over all documents. */
 	gtk_list_store_clear(priv->store);
@@ -411,6 +433,8 @@
 	AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(self);
 
 	priv->page = NULL;
+	priv->popup_menu = NULL;
+	priv->active = FALSE;
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list