From d77f4634648812bb58234dbf4d7cee7029396f08 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 11 Aug 2010 14:41:15 +0000 Subject: [PATCH] r5094 git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/Geany-0_19_1@5142 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 7 +++++++ src/build.c | 6 +++++- src/project.c | 32 ++++++++++++++++++++++++++------ src/project.h | 2 ++ 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e5a2a7c8..26863f304 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-07-07 Nick Treleaven + + * src/build.c, src/project.c, src/project.h: + Show the Project Properties build tab when choosing 'Set Build + Commands' for now to prevent confusion with non-project commands. + + 2010-07-06 Nick Treleaven * src/search.c, doc/geany.txt, doc/geany.html: diff --git a/src/build.c b/src/build.c index 928435f4a..89b5c4120 100644 --- a/src/build.c +++ b/src/build.c @@ -1616,7 +1616,11 @@ static void set_stop_button(gboolean stop) static void on_set_build_commands_activate(GtkWidget *w, gpointer u) { - show_build_commands_dialog(); + /* For now, just show the project dialog */ + if (app->project) + project_build_properties(); + else + show_build_commands_dialog(); } diff --git a/src/project.c b/src/project.c index d119868ef..a0f9c677f 100644 --- a/src/project.c +++ b/src/project.c @@ -70,16 +70,16 @@ static gboolean entries_modified; typedef struct _PropertyDialogElements { GtkWidget *dialog; + GtkWidget *notebook; GtkWidget *name; GtkWidget *description; GtkWidget *file_name; GtkWidget *base_path; GtkWidget *patterns; - BuildTableData build_properties; + BuildTableData build_properties; } PropertyDialogElements; - static gboolean update_config(const PropertyDialogElements *e); static void on_file_save_button_clicked(GtkButton *button, PropertyDialogElements *e); static gboolean load_config(const gchar *filename); @@ -388,6 +388,8 @@ static void on_set_use_base_path_clicked(GtkWidget *unused1, gpointer user_data) } +static gint build_page_num = 0; + static void create_properties_dialog(PropertyDialogElements *e) { GtkWidget *table, *notebook, *build_table; @@ -476,7 +478,8 @@ static void create_properties_dialog(PropertyDialogElements *e) gtk_container_set_border_width(GTK_CONTAINER(build_table), 6); label = gtk_label_new(_("Build")); notebook = ui_lookup_widget(e->dialog, "project_notebook"); - gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), build_table, label, 2); + build_page_num = gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), build_table, label, 2); + e->notebook = notebook; label = gtk_label_new(_("Set the Build non-filetype working directories to use base path:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); @@ -517,13 +520,12 @@ static void create_properties_dialog(PropertyDialogElements *e) #endif label = gtk_label_new(_("Project")); - gtk_widget_show(table); /* needed to switch current page */ gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), table, label, 0); - gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0); + build_page_num++; } -void project_properties(void) +static void show_project_properties(gboolean show_build) { PropertyDialogElements *e = g_new(PropertyDialogElements, 1); GeanyProject *p = app->project; @@ -585,6 +587,12 @@ void project_properties(void) gtk_widget_show_all(e->dialog); + /* note: notebook page must be shown before setting current page */ + if (show_build) + gtk_notebook_set_current_page(GTK_NOTEBOOK(e->notebook), build_page_num); + else + gtk_notebook_set_current_page(GTK_NOTEBOOK(e->notebook), 0); + while (gtk_dialog_run(GTK_DIALOG(e->dialog)) == GTK_RESPONSE_OK) { if (update_config(e)) @@ -599,6 +607,18 @@ void project_properties(void) } +void project_properties(void) +{ + show_project_properties(FALSE); +} + + +void project_build_properties(void) +{ + show_project_properties(TRUE); +} + + /* checks whether there is an already open project and asks the user if he wants to close it or * abort the current action. Returns FALSE when the current action(the caller) should be cancelled * and TRUE if we can go ahead */ diff --git a/src/project.h b/src/project.h index 508ae290a..33eb81e42 100644 --- a/src/project.h +++ b/src/project.h @@ -74,6 +74,8 @@ void project_close(gboolean open_default); void project_properties(void); +void project_build_properties(void); + gboolean project_ask_close(void); -- 2.11.4.GIT