Do not auto complete project filename and base path when they were changed manually.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1202 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-01-18 18:48:43 +00:00
parent 13bcd7868c
commit e005839d55
2 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-01-18 Enrico Tröger <enrico.troeger@uvena.de>
* src/project.c: Do not auto complete project filename and base path
when they were changed manually.
2007-01-18 Nick Treleaven <nick.treleaven@btinternet.com>
* src/keybindings.c:

View File

@ -35,6 +35,8 @@
#endif
static gboolean entries_modified;
// simple struct to keep references to the elements of the properties dialog
typedef struct
{
@ -54,6 +56,7 @@ static void on_file_open_button_clicked(GtkButton *button, GtkWidget *entry);
static void on_folder_open_button_clicked(GtkButton *button, GtkWidget *entry);
static gboolean close_open_project();
static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e);
static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e);
void project_new()
@ -112,6 +115,7 @@ void project_properties()
ok_button, GTK_RESPONSE_OK, NULL);
vbox = ui_dialog_vbox_new(GTK_DIALOG(e->dialog));
entries_modified = FALSE;
table = gtk_table_new(5, 2, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(table), 5);
@ -207,6 +211,9 @@ void project_properties()
g_signal_connect((gpointer) e->name, "changed", G_CALLBACK(on_name_entry_changed), e);
// run the callback manually to initialise the base_path and file_name fields
on_name_entry_changed(GTK_EDITABLE(e->name), e);
g_signal_connect((gpointer) e->file_name, "changed", G_CALLBACK(on_entries_changed), e);
g_signal_connect((gpointer) e->base_path, "changed", G_CALLBACK(on_entries_changed), e);
}
g_signal_connect((gpointer) e->dialog, "response",
G_CALLBACK(on_properties_dialog_response), e);
@ -465,18 +472,21 @@ static void on_folder_open_button_clicked(GtkButton *button, GtkWidget *entry)
#endif
}
// "projects" is part of the default project base path so be carefully when translating
// please avoid special characters and spaces, look at the source for details or ask Frank
#define PROJECT_DIR _("projects")
/* sets the project base path and the project file name according to the project name */
/// TODO cancel the process once base_path resp. file_name has been changed manually
static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e)
{
gchar *base_path;
gchar *file_name;
gchar *name;
if (entries_modified)
return;
name = gtk_editable_get_chars(editable, 0, -1);
if (name != NULL && strlen(name) > 0)
{
@ -499,6 +509,14 @@ static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements
gtk_entry_set_text(GTK_ENTRY(e->base_path), base_path);
gtk_entry_set_text(GTK_ENTRY(e->file_name), file_name);
entries_modified = FALSE;
g_free(base_path);
g_free(file_name);
}
static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e)
{
entries_modified = TRUE;
}