Fix build menu updating

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/build-system@3195 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Lex Trotman 2008-11-10 00:49:16 +00:00
parent c857941e1d
commit 30de1c33b1
4 changed files with 151 additions and 130 deletions

View File

@ -1,3 +1,15 @@
2008-11-10 Lex Trotman <elextr(at)gmail(dot)com>
Fixed build menu updating after dialog close
* src/build.c:
on_includes_arguments_dialog_response calls projects::update_ui()
create_build_menu_gen() fixed reference to build_2_label SB 3
format it
* src/projects.c:
make update_ui() non-static
format it
2008-11-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/build.c:

View File

@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
<meta name="date" content="2008-10-27" />
<meta name="date" content="2008-11-01" />
<style type="text/css">
/*
@ -139,7 +139,7 @@ Stylesheet for Geany's documentation based on a version of John Gabriele.
<br />Nick Treleaven
<br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2008-10-27</td></tr>
<td>2008-11-01</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>0.15</td></tr>
</tbody>
@ -4506,7 +4506,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
Generated on: 2008-11-01 02:40 UTC.
Generated on: 2008-11-04 00:47 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>

View File

@ -1127,9 +1127,9 @@ static void create_build_menu_gen(BuildMenuItems *menu_items)
menu_items->item_make_custom = item;
/* build the code with make object */
if (proj!=NULL && proj->build_2_label!=NULL)
if (proj!=NULL && proj->build_3_label!=NULL)
{
item = gtk_image_menu_item_new_with_mnemonic(proj->build_2_label);
item = gtk_image_menu_item_new_with_mnemonic(proj->build_3_label);
tiptext = NULL;
} /* else if prefs */
else
@ -1601,6 +1601,7 @@ on_includes_arguments_dialog_response (GtkDialog *dialog,
proj->build_3_cmd = g_strdup(newstr);
}
}
update_ui();
}
}

View File

@ -82,7 +82,7 @@ static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e)
#define SHOW_ERR(args) dialogs_show_msgbox(GTK_MESSAGE_ERROR, args)
#define SHOW_ERR1(args,more) dialogs_show_msgbox(GTK_MESSAGE_ERROR, args, more)
#define SHOW_ERR1(args, more) dialogs_show_msgbox(GTK_MESSAGE_ERROR, args, more)
#define MAX_NAME_LEN 50
/* "projects" is part of the default project base path so be careful when translating
* please avoid special characters and spaces, look at the source for details or ask Frank */
@ -91,15 +91,15 @@ static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e)
void project_new()
{
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *image;
GtkWidget *button;
GtkWidget *bbox;
GtkWidget *label;
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *image;
GtkWidget *button;
GtkWidget *bbox;
GtkWidget *label;
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
PropertyDialogElements *e;
gint response;
gint response;
if (! close_open_project()) return;
@ -107,8 +107,8 @@ void project_new()
e = g_new0(PropertyDialogElements, 1);
e->dialog = gtk_dialog_new_with_buttons(_("New Project"), GTK_WINDOW(main_widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
gtk_widget_set_name(e->dialog, "GeanyDialogProject");
bbox = gtk_hbox_new(FALSE, 0);
@ -156,11 +156,11 @@ void project_new()
e->base_path = gtk_entry_new();
gtk_tooltips_set_tip(tooltips, e->base_path,
_("Base directory of all files that make up the project. "
"This can be a new path, or an existing directory tree. "
"You can use paths relative to the project filename."), NULL);
_("Base directory of all files that make up the project. "
"This can be a new path, or an existing directory tree. "
"You can use paths relative to the project filename."), NULL);
bbox = ui_path_box_new(_("Choose Project Base Path"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
ui_table_add_row(GTK_TABLE(table), 2, label, bbox, NULL);
@ -219,6 +219,8 @@ static void run_open_dialog(GtkDialog *dialog)
}
}
}
#endif
@ -228,9 +230,9 @@ void project_open()
#ifdef G_OS_WIN32
gchar *file;
#else
GtkWidget *dialog;
GtkWidget *dialog;
GtkFileFilter *filter;
gchar *locale_path;
gchar *locale_path;
#endif
if (! close_open_project()) return;
@ -254,9 +256,9 @@ void project_open()
#else
dialog = gtk_file_chooser_dialog_new(_("Open Project"), GTK_WINDOW(main_widgets.window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
gtk_widget_set_name(dialog, "GeanyDialogProject");
/* set default Open, so pressing enter can open multiple files */
@ -293,10 +295,11 @@ void project_open()
}
/* Called when creating, opening, closing and updating projects. */
static void update_ui(void)
/* Called when creating, opening, closing and updating projects or changing
* build commands. */
void update_ui(void)
{
build_default_menu();
build_default_menu();
ui_set_window_title(NULL);
build_menu_update(NULL);
}
@ -346,18 +349,18 @@ void project_close(gboolean open_default)
static void create_properties_dialog(PropertyDialogElements *e)
{
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *image;
GtkWidget *button;
GtkWidget *bbox;
GtkWidget *label;
GtkWidget *swin;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *image;
GtkWidget *button;
GtkWidget *bbox;
GtkWidget *label;
GtkWidget *swin;
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips"));
e->dialog = gtk_dialog_new_with_buttons(_("Project Properties"), GTK_WINDOW(main_widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
gtk_dialog_add_buttons(GTK_DIALOG(e->dialog), GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
gtk_widget_set_name(e->dialog, "GeanyDialogProject");
@ -369,32 +372,32 @@ static void create_properties_dialog(PropertyDialogElements *e)
label = gtk_label_new(_("Name:"));
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
e->name = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(e->name), MAX_NAME_LEN);
gtk_table_attach(GTK_TABLE(table), e->name, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
label = gtk_label_new(_("Filename:"));
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
e->file_name = gtk_entry_new();
gtk_editable_set_editable(GTK_EDITABLE(e->file_name), FALSE); /* read-only */
gtk_editable_set_editable(GTK_EDITABLE(e->file_name), FALSE); /* read-only */
gtk_table_attach(GTK_TABLE(table), e->file_name, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
label = gtk_label_new(_("Description:"));
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
e->description = gtk_text_view_new();
@ -402,45 +405,45 @@ static void create_properties_dialog(PropertyDialogElements *e)
swin = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_set_size_request(swin, 250, 80);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), GTK_WIDGET(e->description));
gtk_table_attach(GTK_TABLE(table), swin, 1, 2, 2, 3,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
label = gtk_label_new(_("Base path:"));
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
e->base_path = gtk_entry_new();
gtk_tooltips_set_tip(tooltips, e->base_path,
_("Base directory of all files that make up the project. "
"This can be a new path, or an existing directory tree. "
"You can use paths relative to the project filename."), NULL);
_("Base directory of all files that make up the project. "
"This can be a new path, or an existing directory tree. "
"You can use paths relative to the project filename."), NULL);
bbox = ui_path_box_new(_("Choose Project Base Path"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 3, 4,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
e->make_in_base_path = gtk_check_button_new_with_label(_("Make in base path"));
gtk_table_attach(GTK_TABLE(table), e->make_in_base_path, 0, 3, 4, 5,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
label = gtk_label_new(_("Run command:"));
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
e->run_cmd = gtk_entry_new();
gtk_tooltips_set_tip(tooltips, e->run_cmd,
_("Command-line to run in the project base directory. "
"Options can be appended to the command. "
"Leave blank to use the default run command."), NULL);
_("Command-line to run in the project base directory. "
"Options can be appended to the command. "
"Leave blank to use the default run command."), NULL);
button = gtk_button_new();
g_signal_connect(button, "clicked", G_CALLBACK(on_file_open_button_clicked), e->run_cmd);
image = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON);
@ -449,26 +452,26 @@ static void create_properties_dialog(PropertyDialogElements *e)
gtk_box_pack_start_defaults(GTK_BOX(bbox), e->run_cmd);
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 5, 6,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
#if 0
label = gtk_label_new(_("File patterns:"));
/* <small>Separate multiple patterns by a new line</small> */
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_misc_set_alignment(GTK_MISC(label), -1, 0);
e->patterns = gtk_text_view_new();
swin = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_set_size_request(swin, -1, 80);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swin),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(swin), GTK_WIDGET(e->patterns));
gtk_table_attach(GTK_TABLE(table), swin, 1, 2, 6, 7,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
#endif
gtk_container_add(GTK_CONTAINER(vbox), table);
@ -478,8 +481,8 @@ static void create_properties_dialog(PropertyDialogElements *e)
void project_properties()
{
PropertyDialogElements *e = g_new(PropertyDialogElements, 1);
GeanyProject *p = app->project;
gint response;
GeanyProject *p = app->project;
gint response;
g_return_if_fail(app->project != NULL);
@ -491,18 +494,18 @@ void project_properties()
gtk_entry_set_text(GTK_ENTRY(e->name), p->name);
if (p->description != NULL)
{ /* set text */
{ /* set text */
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
gtk_text_buffer_set_text(buffer, p->description, -1);
}
#if 0
if (p->file_patterns != NULL)
{ /* set the file patterns */
gint i;
gint len = g_strv_length(p->file_patterns);
{ /* set the file patterns */
gint i;
gint len = g_strv_length(p->file_patterns);
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->patterns));
GString *str = g_string_sized_new(len * 4);
GString *str = g_string_sized_new(len * 4);
for (i = 0; i < len; i++)
{
@ -520,7 +523,7 @@ void project_properties()
gtk_entry_set_text(GTK_ENTRY(e->file_name), p->file_name);
gtk_entry_set_text(GTK_ENTRY(e->base_path), p->base_path);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e->make_in_base_path),
p->make_in_base_path);
p->make_in_base_path);
if (p->run_cmd != NULL)
gtk_entry_set_text(GTK_ENTRY(e->run_cmd), p->run_cmd);
@ -547,8 +550,8 @@ static gboolean close_open_project()
if (app->project != NULL)
{
if (dialogs_show_question_full(NULL, GTK_STOCK_CLOSE, GTK_STOCK_CANCEL,
_("Do you want to close it before proceeding?"),
_("The '%s' project is already open."), app->project->name))
_("Do you want to close it before proceeding?"),
_("The '%s' project is already open."), app->project->name))
{
project_close(FALSE);
return TRUE;
@ -565,11 +568,11 @@ static gboolean close_open_project()
* Returns: FALSE if the user needs to change any data. */
static gboolean update_config(const PropertyDialogElements *e)
{
const gchar *name, *file_name, *base_path;
gchar *locale_filename;
gint name_len;
gint err_code = 0;
gboolean new_project = FALSE;
const gchar *name, *file_name, *base_path;
gchar *locale_filename;
gint name_len;
gint err_code = 0;
gboolean new_project = FALSE;
GeanyProject *p;
g_return_val_if_fail(e != NULL, TRUE);
@ -600,11 +603,11 @@ static gboolean update_config(const PropertyDialogElements *e)
locale_filename = utils_get_locale_from_utf8(file_name);
base_path = gtk_entry_get_text(GTK_ENTRY(e->base_path));
if (NZV(base_path))
{ /* check whether the given directory actually exists */
{ /* check whether the given directory actually exists */
gchar *locale_path = utils_get_locale_from_utf8(base_path);
if (! g_path_is_absolute(locale_path))
{ /* relative base path, so add base dir of project file name */
{ /* relative base path, so add base dir of project file name */
gchar *dir = g_path_get_dirname(locale_filename);
setptr(locale_path, g_strconcat(dir, G_DIR_SEPARATOR_S, locale_path, NULL));
g_free(dir);
@ -615,9 +618,9 @@ static gboolean update_config(const PropertyDialogElements *e)
gboolean create_dir;
create_dir = dialogs_show_question_full(NULL, GTK_STOCK_OK, GTK_STOCK_CANCEL,
_("Create the project's base path directory?"),
_("The path \"%s\" does not exist."),
base_path);
_("Create the project's base path directory?"),
_("The path \"%s\" does not exist."),
base_path);
if (create_dir)
err_code = utils_mkdir(locale_path, TRUE);
@ -626,7 +629,7 @@ static gboolean update_config(const PropertyDialogElements *e)
{
if (err_code != 0)
SHOW_ERR1(_("Project base directory could not be created (%s)."),
g_strerror(err_code));
g_strerror(err_code));
gtk_widget_grab_focus(e->base_path);
utils_free_pointers(locale_path, locale_filename, NULL);
return FALSE;
@ -656,7 +659,7 @@ static gboolean update_config(const PropertyDialogElements *e)
/* use "." if base_path is empty */
setptr(p->base_path, g_strdup(NZV(base_path) ? base_path : "./"));
if (! new_project) /* save properties specific fields */
if (! new_project) /* save properties specific fields */
{
GtkTextIter start, end;
/*gchar *tmp;*/
@ -700,7 +703,7 @@ static void run_dialog(GtkWidget *dialog, GtkWidget *entry)
{
/* set filename in the file chooser dialog */
const gchar *utf8_filename = gtk_entry_get_text(GTK_ENTRY(entry));
gchar *locale_filename = utils_get_locale_from_utf8(utf8_filename);
gchar *locale_filename = utils_get_locale_from_utf8(utf8_filename);
if (g_path_is_absolute(locale_filename))
{
@ -747,6 +750,8 @@ static void run_dialog(GtkWidget *dialog, GtkWidget *entry)
}
gtk_widget_destroy(dialog);
}
#endif
@ -754,7 +759,8 @@ static void on_file_save_button_clicked(GtkButton *button, PropertyDialogElement
{
#ifdef G_OS_WIN32
gchar *path = win32_show_project_open_dialog(e->dialog, _("Choose Project Filename"),
gtk_entry_get_text(GTK_ENTRY(e->file_name)), TRUE, TRUE);
gtk_entry_get_text(GTK_ENTRY(
e->file_name)), TRUE, TRUE);
if (path != NULL)
{
gtk_entry_set_text(GTK_ENTRY(e->file_name), path);
@ -765,9 +771,9 @@ static void on_file_save_button_clicked(GtkButton *button, PropertyDialogElement
/* initialise the dialog */
dialog = gtk_file_chooser_dialog_new(_("Choose Project Filename"), NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
gtk_widget_set_name(dialog, "GeanyDialogProject");
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE);
@ -783,7 +789,8 @@ static void on_file_open_button_clicked(GtkButton *button, PropertyDialogElement
{
#ifdef G_OS_WIN32
gchar *path = win32_show_project_open_dialog(e->dialog, _("Choose Project Run Command"),
gtk_entry_get_text(GTK_ENTRY(e->run_cmd)), FALSE, FALSE);
gtk_entry_get_text(GTK_ENTRY(
e->run_cmd)), FALSE, FALSE);
if (path != NULL)
{
gtk_entry_set_text(GTK_ENTRY(e->run_cmd), path);
@ -794,9 +801,9 @@ static void on_file_open_button_clicked(GtkButton *button, PropertyDialogElement
/* initialise the dialog */
dialog = gtk_file_chooser_dialog_new(_("Choose Project Run Command"), NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
gtk_widget_set_name(dialog, "GeanyDialog");
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE);
@ -811,9 +818,9 @@ static void on_file_open_button_clicked(GtkButton *button, PropertyDialogElement
/* sets the project base path and the project file name according to the project name */
static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e)
{
gchar *base_path;
gchar *file_name;
gchar *name;
gchar *base_path;
gchar *file_name;
gchar *name;
const gchar *project_dir = local_prefs.project_file_path;
if (entries_modified)
@ -823,13 +830,13 @@ static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements
if (name != NULL && strlen(name) > 0)
{
base_path = g_strconcat(project_dir, G_DIR_SEPARATOR_S,
name, G_DIR_SEPARATOR_S, NULL);
name, G_DIR_SEPARATOR_S, NULL);
if (project_prefs.project_file_in_basedir)
file_name = g_strconcat(project_dir, G_DIR_SEPARATOR_S, name, G_DIR_SEPARATOR_S,
name, "." GEANY_PROJECT_EXT, NULL);
name, "." GEANY_PROJECT_EXT, NULL);
else
file_name = g_strconcat(project_dir, G_DIR_SEPARATOR_S,
name, "." GEANY_PROJECT_EXT, NULL);
name, "." GEANY_PROJECT_EXT, NULL);
}
else
{
@ -880,7 +887,7 @@ gboolean project_load_file(const gchar *locale_file_name)
* The filename is expected in the locale encoding. */
static gboolean load_config(const gchar *filename)
{
GKeyFile *config;
GKeyFile *config;
GeanyProject *p;
/* there should not be an open project */
@ -903,12 +910,12 @@ static gboolean load_config(const gchar *filename)
p->run_cmd = utils_get_setting_string(config, "project", "run_cmd", "");
p->file_patterns = g_key_file_get_string_list(config, "project", "file_patterns", NULL, NULL);
p->build_1_cmd = utils_get_setting_string(config, "build_menu", "cmd_1", NULL );
p->build_2_cmd = utils_get_setting_string(config, "build_menu", "cmd_2", NULL );
p->build_3_cmd = utils_get_setting_string(config, "build_menu", "cmd_3", NULL );
p->build_1_label = utils_get_setting_string(config, "build_menu", "label_1", NULL );
p->build_2_label = utils_get_setting_string(config, "build_menu", "label_2", NULL );
p->build_3_label = utils_get_setting_string(config, "build_menu", "label_3", NULL );
p->build_1_cmd = utils_get_setting_string(config, "build_menu", "cmd_1", NULL);
p->build_2_cmd = utils_get_setting_string(config, "build_menu", "cmd_2", NULL);
p->build_3_cmd = utils_get_setting_string(config, "build_menu", "cmd_3", NULL);
p->build_1_label = utils_get_setting_string(config, "build_menu", "label_1", NULL);
p->build_2_label = utils_get_setting_string(config, "build_menu", "label_2", NULL);
p->build_3_label = utils_get_setting_string(config, "build_menu", "label_3", NULL);
if (project_prefs.project_session)
{
@ -939,10 +946,10 @@ static gboolean load_config(const gchar *filename)
static gboolean write_config(gboolean emit_signal)
{
GeanyProject *p;
GKeyFile *config;
gchar *filename;
gchar *data;
gboolean ret = FALSE;
GKeyFile *config;
gchar *filename;
gchar *data;
gboolean ret = FALSE;
g_return_val_if_fail(app->project != NULL, FALSE);
@ -975,7 +982,7 @@ static gboolean write_config(gboolean emit_signal)
g_key_file_set_string(config, "build_menu", "label_3", p->build_3_label);
if (p->file_patterns)
g_key_file_set_string_list(config, "project", "file_patterns",
(const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
(const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
/* store the session files into the project too */
if (project_prefs.project_session)
@ -1011,7 +1018,8 @@ gchar *project_get_base_path()
if (g_path_is_absolute(project->base_path))
return g_strdup(project->base_path);
else
{ /* build base_path out of project file name's dir and base_path */
{
/* build base_path out of project file name's dir and base_path */
gchar *path;
gchar *dir = g_path_get_dirname(project->file_name);
@ -1049,7 +1057,7 @@ void project_save_prefs(GKeyFile *config)
g_key_file_set_string(config, "project", "session_file", utf8_filename);
}
g_key_file_set_string(config, "project", "project_file_path",
NVL(local_prefs.project_file_path, ""));
NVL(local_prefs.project_file_path, ""));
}
@ -1059,14 +1067,14 @@ void project_load_prefs(GKeyFile *config)
{
g_return_if_fail(project_prefs.session_file == NULL);
project_prefs.session_file = utils_get_setting_string(config, "project",
"session_file", "");
"session_file", "");
}
local_prefs.project_file_path = utils_get_setting_string(config, "project",
"project_file_path", NULL);
"project_file_path", NULL);
if (local_prefs.project_file_path == NULL)
{
local_prefs.project_file_path = g_strconcat(g_get_home_dir(),
G_DIR_SEPARATOR_S, PROJECT_DIR, NULL);
G_DIR_SEPARATOR_S, PROJECT_DIR, NULL);
}
}
@ -1080,14 +1088,14 @@ void project_setup_prefs()
g_return_if_fail(local_prefs.project_file_path != NULL);
gtk_entry_set_text(GTK_ENTRY(path_entry), local_prefs.project_file_path);
ui_setup_open_button_callback(path_btn, NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(path_entry));
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(path_entry));
}
/* Update project-related preferences after using the Preferences dialog. */
void project_apply_prefs()
{
GtkWidget *path_entry = lookup_widget(ui_widgets.prefs_dialog, "project_file_path_entry");
GtkWidget *path_entry = lookup_widget(ui_widgets.prefs_dialog, "project_file_path_entry");
const gchar *str;
str = gtk_entry_get_text(GTK_ENTRY(path_entry));