SF.net SVN: geany: [1497] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue May 1 12:27:56 UTC 2007


Revision: 1497
          http://svn.sourceforge.net/geany/?rev=1497&view=rev
Author:   ntrel
Date:     2007-05-01 05:27:56 -0700 (Tue, 01 May 2007)

Log Message:
-----------
Allow run for any file (with a path) when a valid project run command
is set.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/build.c
    trunk/src/project.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-05-01 11:47:06 UTC (rev 1496)
+++ trunk/ChangeLog	2007-05-01 12:27:56 UTC (rev 1497)
@@ -5,6 +5,9 @@
    rebuilding of files dependent on support.h.
  * src/project.c:
    Hide the unused File Patterns field in the project properties dialog.
+ * src/build.c, src/project.c:
+   Allow run for any file (with a path) when a valid project run command
+   is set.
 
 
 2007-04-30  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2007-05-01 11:47:06 UTC (rev 1496)
+++ trunk/src/build.c	2007-05-01 12:27:56 UTC (rev 1497)
@@ -1600,7 +1600,7 @@
 void build_menu_update(gint idx)
 {
 	filetype *ft;
-	gboolean have_path, can_build, can_make, can_run, can_set_args, have_errors;
+	gboolean have_path, can_build, can_make, can_run, can_stop, can_set_args, have_errors;
 	BuildMenuItems *menu_items;
 
 	if (idx == -1)
@@ -1654,13 +1654,20 @@
 	if (menu_items->item_make_object)
 		gtk_widget_set_sensitive(menu_items->item_make_object, can_make);
 
-	can_run = have_path && run_info.pid <= (GPid) 1;
-	/* can_run only applies item_exec2
-	 * item_exec is enabled for both run and stop commands */
+	if (app->project && NZV(app->project->run_cmd))
+		can_run = have_path;	// for now run is disabled for all untitled files
+	else
+		can_run = have_path && ft->actions->can_exec;
+
+	can_stop = run_info.pid > (GPid) 1;
+	can_run &= ! can_stop;
+
+	/* item_exec is enabled for both run and stop commands */
 	if (menu_items->item_exec)
-		gtk_widget_set_sensitive(menu_items->item_exec, have_path && ft->actions->can_exec);
+		gtk_widget_set_sensitive(menu_items->item_exec, can_run || can_stop);
+	/* item_exec2 is disabled if there's a running process already */
 	if (menu_items->item_exec2)
-		gtk_widget_set_sensitive(menu_items->item_exec2, can_run && ft->actions->can_exec);
+		gtk_widget_set_sensitive(menu_items->item_exec2, can_run);
 
 	can_set_args =
 		((ft->actions->can_compile ||
@@ -1671,11 +1678,12 @@
 		gtk_widget_set_sensitive(menu_items->item_set_args, can_set_args);
 
 	gtk_widget_set_sensitive(app->compile_button, can_build && ft->actions->can_compile);
-	gtk_widget_set_sensitive(app->run_button, have_path && ft->actions->can_exec);
+	gtk_widget_set_sensitive(app->run_button, can_run || can_stop);
 
 	// show the stop command if a program is running, otherwise show run command
-	set_stop_button(run_info.pid > (GPid) 1);
+	set_stop_button(can_stop);
 
+	// simply enable next error command if the compiler window has any items
 	have_errors = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_compiler),
 		NULL) > 0;
 	gtk_widget_set_sensitive(menu_items->item_next_error, have_errors);

Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c	2007-05-01 11:47:06 UTC (rev 1496)
+++ trunk/src/project.c	2007-05-01 12:27:56 UTC (rev 1497)
@@ -39,6 +39,7 @@
 #ifdef G_OS_WIN32
 # include "win32.h"
 #endif
+#include "build.h"
 
 
 ProjectPrefs project_prefs = {NULL};
@@ -298,6 +299,8 @@
 
 	g_free(app->project);
 	app->project = NULL;
+
+	build_menu_update(-1);
 }
 
 
@@ -474,8 +477,12 @@
 	retry:
 	response = gtk_dialog_run(GTK_DIALOG(e->dialog));
 	if (response == GTK_RESPONSE_OK)
+	{
 		if (! update_config(e))
 			goto retry;
+		// successfully updated properties
+		build_menu_update(-1);
+	}
 
 	gtk_widget_destroy(e->dialog);
 	g_free(e);
@@ -839,6 +846,7 @@
 
 	g_key_file_free(config);
 
+	build_menu_update(-1);
 	return 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