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

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Jan 3 23:22:44 UTC 2010


Revision: 1107
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1107&view=rev
Author:   eht16
Date:     2010-01-03 23:22:44 +0000 (Sun, 03 Jan 2010)

Log Message:
-----------
Move the code for creating a new task into create_task().

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

Modified: trunk/geany-plugins/addons/ChangeLog
===================================================================
--- trunk/geany-plugins/addons/ChangeLog	2010-01-03 21:51:05 UTC (rev 1106)
+++ trunk/geany-plugins/addons/ChangeLog	2010-01-03 23:22:44 UTC (rev 1107)
@@ -1,3 +1,9 @@
+2010-01-03  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/ao_tasks.c:
+   Move the code for creating a new task into create_task().
+
+
 2010-01-01  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/*.c, src/*.h:

Modified: trunk/geany-plugins/addons/src/ao_tasks.c
===================================================================
--- trunk/geany-plugins/addons/src/ao_tasks.c	2010-01-03 21:51:05 UTC (rev 1106)
+++ trunk/geany-plugins/addons/src/ao_tasks.c	2010-01-03 23:22:44 UTC (rev 1107)
@@ -512,10 +512,35 @@
 }
 
 
+static void create_task(AoTasks *t, GeanyDocument *doc, gint line,
+						const gchar *line_buf, const gchar *display_name)
+{
+	AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
+	gchar *context, *tooltip;
+
+	/* retrieve the following line and use it for the tooltip */
+	context = g_strstrip(sci_get_line(doc->editor->sci, line + 1));
+	setptr(context, g_strconcat(
+		_("Context:"), "\n", line_buf, "\n", context, NULL));
+	tooltip = g_markup_escape_text(context, -1);
+
+	/* add the task into the list */
+	gtk_list_store_insert_with_values(priv->store, NULL, -1,
+		TLIST_COL_FILENAME, DOC_FILENAME(doc),
+		TLIST_COL_DISPLAY_FILENAME, display_name,
+		TLIST_COL_LINE, line + 1,
+		TLIST_COL_NAME, line_buf,
+		TLIST_COL_TOOLTIP, tooltip,
+		-1);
+	g_free(context);
+	g_free(tooltip);
+}
+
+
 static void update_tasks_for_doc(AoTasks *t, GeanyDocument *doc)
 {
 	guint lines, line;
-	gchar *line_buf, *context, *display_name, *tooltip;
+	gchar *line_buf, *display_name;
 	gchar **token;
 	AoTasksPrivate *priv = AO_TASKS_GET_PRIVATE(t);
 
@@ -531,20 +556,7 @@
 			{
 				if (NZV(*token) && strstr(line_buf, *token) != NULL)
 				{
-					context = g_strstrip(sci_get_line(doc->editor->sci, line + 1));
-					setptr(context, g_strconcat(
-						_("Context:"), "\n", line_buf, "\n", context, NULL));
-					tooltip = g_markup_escape_text(context, -1);
-
-					gtk_list_store_insert_with_values(priv->store, NULL, -1,
-						TLIST_COL_FILENAME, DOC_FILENAME(doc),
-						TLIST_COL_DISPLAY_FILENAME, display_name,
-						TLIST_COL_LINE, line + 1,
-						TLIST_COL_NAME, line_buf,
-						TLIST_COL_TOOLTIP, tooltip,
-						-1);
-					g_free(context);
-					g_free(tooltip);
+					create_task(t, doc, line, line_buf, display_name);
 					/* if we found a token, continue on next line */
 					break;
 				}


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