Allow run for any file (with a path) when a valid project run command
is set. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1497 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
27ebd4b2b0
commit
f23abfa7cd
@ -5,6 +5,9 @@
|
|||||||
rebuilding of files dependent on support.h.
|
rebuilding of files dependent on support.h.
|
||||||
* src/project.c:
|
* src/project.c:
|
||||||
Hide the unused File Patterns field in the project properties dialog.
|
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@btinternet.com>
|
2007-04-30 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||||
|
24
src/build.c
24
src/build.c
@ -1600,7 +1600,7 @@ static gboolean is_c_header(const gchar *fname)
|
|||||||
void build_menu_update(gint idx)
|
void build_menu_update(gint idx)
|
||||||
{
|
{
|
||||||
filetype *ft;
|
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;
|
BuildMenuItems *menu_items;
|
||||||
|
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
@ -1654,13 +1654,20 @@ void build_menu_update(gint idx)
|
|||||||
if (menu_items->item_make_object)
|
if (menu_items->item_make_object)
|
||||||
gtk_widget_set_sensitive(menu_items->item_make_object, can_make);
|
gtk_widget_set_sensitive(menu_items->item_make_object, can_make);
|
||||||
|
|
||||||
can_run = have_path && run_info.pid <= (GPid) 1;
|
if (app->project && NZV(app->project->run_cmd))
|
||||||
/* can_run only applies item_exec2
|
can_run = have_path; // for now run is disabled for all untitled files
|
||||||
* item_exec is enabled for both run and stop commands */
|
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)
|
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)
|
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 =
|
can_set_args =
|
||||||
((ft->actions->can_compile ||
|
((ft->actions->can_compile ||
|
||||||
@ -1671,11 +1678,12 @@ void build_menu_update(gint idx)
|
|||||||
gtk_widget_set_sensitive(menu_items->item_set_args, can_set_args);
|
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->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
|
// 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),
|
have_errors = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_compiler),
|
||||||
NULL) > 0;
|
NULL) > 0;
|
||||||
gtk_widget_set_sensitive(menu_items->item_next_error, have_errors);
|
gtk_widget_set_sensitive(menu_items->item_next_error, have_errors);
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
# include "win32.h"
|
# include "win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "build.h"
|
||||||
|
|
||||||
|
|
||||||
ProjectPrefs project_prefs = {NULL};
|
ProjectPrefs project_prefs = {NULL};
|
||||||
@ -298,6 +299,8 @@ void project_close()
|
|||||||
|
|
||||||
g_free(app->project);
|
g_free(app->project);
|
||||||
app->project = NULL;
|
app->project = NULL;
|
||||||
|
|
||||||
|
build_menu_update(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -474,8 +477,12 @@ void project_properties()
|
|||||||
retry:
|
retry:
|
||||||
response = gtk_dialog_run(GTK_DIALOG(e->dialog));
|
response = gtk_dialog_run(GTK_DIALOG(e->dialog));
|
||||||
if (response == GTK_RESPONSE_OK)
|
if (response == GTK_RESPONSE_OK)
|
||||||
|
{
|
||||||
if (! update_config(e))
|
if (! update_config(e))
|
||||||
goto retry;
|
goto retry;
|
||||||
|
// successfully updated properties
|
||||||
|
build_menu_update(-1);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_destroy(e->dialog);
|
gtk_widget_destroy(e->dialog);
|
||||||
g_free(e);
|
g_free(e);
|
||||||
@ -839,6 +846,7 @@ static gboolean load_config(const gchar *filename)
|
|||||||
|
|
||||||
g_key_file_free(config);
|
g_key_file_free(config);
|
||||||
|
|
||||||
|
build_menu_update(-1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user