From c6b38b861e5fa7bbe7f7b57d73a13f116247a5c3 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Thu, 29 Sep 2011 18:03:36 +0000 Subject: [PATCH] When saving on build, prompt for a filename if necessary. Emit the "build-start" signal only if saving succeeds. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/unstable@5972 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 7 +++++++ doc/pluginsignals.c | 2 +- src/build.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c661d9e7..fea3e855 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-09-29 Nick Treleaven + + * src/build.c, doc/pluginsignals.c: + When saving on build, prompt for a filename if necessary. + Emit the "build-start" signal only if saving succeeds. + + 2011-09-21 Nick Treleaven * src/build.c: diff --git a/doc/pluginsignals.c b/doc/pluginsignals.c index 5bc76fe1..bcf175b5 100644 --- a/doc/pluginsignals.c +++ b/doc/pluginsignals.c @@ -187,7 +187,7 @@ signal void (*project_dialog_confirmed)(GObject *obj, GtkWidget *notebook, gpoin */ signal void (*geany_startup_complete)(GObject *obj, gpointer user_data); -/** Sent before build is started. Plugins can use this signal e.g. to save the opened documents +/** Sent before build is started. A plugin could use this signal e.g. to save all unsaved documents * before the build starts. * * @param obj a GeanyObject instance, should be ignored. diff --git a/src/build.c b/src/build.c index fe95637a..82970f6c 100644 --- a/src/build.c +++ b/src/build.c @@ -1272,10 +1272,16 @@ static void on_build_menu_item(GtkWidget *w, gpointer user_data) gint grp = GPOINTER_TO_GRP(user_data); gint cmd = GPOINTER_TO_CMD(user_data); + if (doc && doc->changed) + { + if (document_need_save_as(doc) && !dialogs_show_save_as()) + return; + + if (!document_save_file(doc, FALSE)) + return; + } g_signal_emit_by_name(geany_object, "build-start"); - if (doc && doc->changed) - document_save_file(doc, FALSE); if (grp == GEANY_GBG_NON_FT && cmd == GBO_TO_CMD(GEANY_GBO_CUSTOM)) { static GtkWidget *dialog = NULL; /* keep dialog for combo history */