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

frlan at users.sourceforge.net frlan at xxxxx
Sun Jun 27 10:57:28 UTC 2010


Revision: 1469
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1469&view=rev
Author:   frlan
Date:     2010-06-27 10:57:28 +0000 (Sun, 27 Jun 2010)

Log Message:
-----------
Addons/XMLtagging: Add a placeholder %s to insert also the selection to tag. This allows 'a href="%s"' to become '<a href="$selection">$selection</a>' where $selection is the selected text on document.

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

Modified: trunk/geany-plugins/addons/ChangeLog
===================================================================
--- trunk/geany-plugins/addons/ChangeLog	2010-06-27 10:31:30 UTC (rev 1468)
+++ trunk/geany-plugins/addons/ChangeLog	2010-06-27 10:57:28 UTC (rev 1469)
@@ -1,3 +1,11 @@
+2010-06-27  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
+
+ * src/ao_xmltagging.c:
+   Add a placeholder %s to insert also the selection to tag. This allows
+   a href="%s" to become <a href="$selection">$selection</a> where
+   $selection is the selected text on document.
+
+
 2010-06-26  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
 
  * src/ao_xmltagging.c:

Modified: trunk/geany-plugins/addons/src/ao_xmltagging.c
===================================================================
--- trunk/geany-plugins/addons/src/ao_xmltagging.c	2010-06-27 10:31:30 UTC (rev 1468)
+++ trunk/geany-plugins/addons/src/ao_xmltagging.c	2010-06-27 10:57:28 UTC (rev 1469)
@@ -47,6 +47,7 @@
 		GtkWidget *hbox = NULL;
 		GtkWidget *label = NULL;
 		GtkWidget *textbox = NULL;
+		GtkWidget *textline = NULL;
 
 		dialog = gtk_dialog_new_with_buttons(_("XML tagging"),
 							 GTK_WINDOW(geany->main_widgets->window),
@@ -62,11 +63,15 @@
 		label = gtk_label_new(_("Tag name to be inserted:"));
 		textbox = gtk_entry_new();
 
+		textline = gtk_label_new(
+			_("%s will be replaced with your current selection. Please keep care on your selection"));
+
 		gtk_container_add(GTK_CONTAINER(hbox), label);
 		gtk_container_add(GTK_CONTAINER(hbox), textbox);
 		gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
 		gtk_container_add(GTK_CONTAINER(vbox), hbox);
+		gtk_container_add(GTK_CONTAINER(vbox), textline);
 
 		g_signal_connect(G_OBJECT(textbox), "activate",
 			G_CALLBACK(enter_key_pressed_in_entry), dialog);
@@ -84,7 +89,14 @@
 			if (NZV(tag))
 			{
 				gint end = 0;
+				GString *tmp = NULL;
 				const gchar *end_tag;
+
+				/* First we check for %s and replace it with selection*/
+				tmp = g_string_new(tag);
+				utils_string_replace_all(tmp, "%s", selection);
+				tag = g_string_free(tmp, FALSE);
+
 				/* We try to find a space inside the inserted tag as we
 				 * only need to close the tag with part until first space.
 				 * */


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