SF.net SVN: geany:[5675] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Fri Apr 1 20:52:32 UTC 2011


Revision: 5675
          http://geany.svn.sourceforge.net/geany/?rev=5675&view=rev
Author:   colombanw
Date:     2011-04-01 20:52:31 +0000 (Fri, 01 Apr 2011)

Log Message:
-----------
Make `Send selection to` send the current line if there is no selection

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/src/tools.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-04-01 16:27:38 UTC (rev 5674)
+++ trunk/ChangeLog	2011-04-01 20:52:31 UTC (rev 5675)
@@ -36,6 +36,9 @@
    information in them but only use the UTF-8 compatible part of
    ISO-8859-1 to be properly loaded as ISO-8859-1, rather than UTF-8.
    Also fix check for locale encoding.
+ * src/tools.c, doc/geany.txt, doc/geany.html:
+   Make `Send selection to` send the current line if there is no
+   selection.
 
 
 2011-03-31  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2011-04-01 16:27:38 UTC (rev 5674)
+++ trunk/doc/geany.html	2011-04-01 20:52:31 UTC (rev 5675)
@@ -1322,6 +1322,7 @@
 Geany. To help finding errors in executing the command, the output
 of the program's standard error will be printed on Geany's standard
 output.</p>
+<p>If there is no selection, the whole current line is used instead.</p>
 <p>To add a custom command, use the <em>Send Selection to->Set Custom
 Commands</em> menu item. Click on <em>Add</em> to get a new text entry and type
 the command. You can also specify some command line options. To

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2011-04-01 16:27:38 UTC (rev 5674)
+++ trunk/doc/geany.txt	2011-04-01 20:52:31 UTC (rev 5675)
@@ -880,6 +880,8 @@
 of the program's standard error will be printed on Geany's standard
 output.
 
+If there is no selection, the whole current line is used instead.
+
 To add a custom command, use the *Send Selection to->Set Custom
 Commands* menu item. Click on *Add* to get a new text entry and type
 the command. You can also specify some command line options. To

Modified: trunk/src/tools.c
===================================================================
--- trunk/src/tools.c	2011-04-01 16:27:38 UTC (rev 5674)
+++ trunk/src/tools.c	2011-04-01 20:52:31 UTC (rev 5675)
@@ -240,7 +240,7 @@
 	g_return_if_fail(doc != NULL && command != NULL);
 
 	if (! sci_has_selection(doc->editor->sci))
-		return;
+		editor_select_lines(doc->editor, FALSE);
 
 	if (!g_shell_parse_argv(command, NULL, &argv, &error))
 	{
@@ -398,33 +398,6 @@
 }
 
 
-/* enable or disable all custom command menu items when the sub menu is opened */
-static void cc_on_custom_command_menu_activate(GtkMenuItem *menuitem, gpointer user_data)
-{
-	GeanyDocument *doc = document_get_current();
-	gint i, len;
-	gboolean enable;
-	GList *children, *node;
-
-	g_return_if_fail(doc != NULL);
-
-	enable = sci_has_selection(doc->editor->sci) && (ui_prefs.custom_commands != NULL);
-
-	children = gtk_container_get_children(GTK_CONTAINER(user_data));
-	len = g_list_length(children);
-	i = 0;
-	foreach_list(node, children)
-	{
-		if (i == (len - 2))
-			break; /* stop before the last two elements (the seperator and the set entry) */
-
-		gtk_widget_set_sensitive(GTK_WIDGET(node->data), enable);
-		i++;
-	}
-	g_list_free(children);
-}
-
-
 static void cc_on_custom_command_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
 	GeanyDocument *doc = document_get_current();
@@ -479,7 +452,6 @@
 	GtkMenu *menu_edit = GTK_MENU(ui_lookup_widget(main_widgets.window, "send_selection_to2_menu"));
 	GtkWidget *item;
 	GList *me_children, *node;
-	static gboolean signal_set = FALSE;
 
 	/* first clean the menus to be able to rebuild them */
 	me_children = gtk_container_get_children(GTK_CONTAINER(menu_edit));
@@ -515,13 +487,6 @@
 	gtk_widget_show(item);
 
 	cc_insert_custom_command_items(menu_edit, _("Set Custom Commands"), -1);
-
-	if (! signal_set)
-	{
-		g_signal_connect(ui_lookup_widget(main_widgets.window, "send_selection_to2"),
-					"activate", G_CALLBACK(cc_on_custom_command_menu_activate), menu_edit);
-		signal_set = TRUE;
-	}
 }
 
 


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



More information about the Commits mailing list