3 Copyright (C) 2000 Kh. Naba Kumar Singh
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <sys/types.h>
33 #include "build_file.h"
35 #include "clean_project.h"
36 #include "build_project.h"
39 static void (*on_clean_finished_cb
) (void);
42 clean_project (void (*on_clean_cb
) (void))
44 gchar
*cmd
, *prj_name
;
46 if(app
->project_dbase
->is_saved
== FALSE
47 && app
->project_dbase
->project_is_open
==TRUE
)
50 ret
= project_dbase_save_project(app
->project_dbase
);
55 if (app
->project_dbase
->project_is_open
)
57 cmd
= command_editor_get_command (app
->command_editor
,
61 anjuta_warning (_("Unable to clean Project. Check Settings->Commands."));
64 chdir (app
->project_dbase
->top_proj_dir
);
66 /* set up the callback for a successful finish */
67 on_clean_finished_cb
= on_clean_cb
;
69 /* launche 'make clean' */
70 if (build_execute_command (cmd
) == FALSE
)
76 anjuta_update_app_status (TRUE
, _("Clean"));
77 an_message_manager_clear (app
->messages
, MESSAGE_BUILD
);
78 an_message_manager_append (app
->messages
,
79 _("Cleaning the source directory of the Project: "),
81 prj_name
= project_dbase_get_proj_name (app
->project_dbase
);
82 an_message_manager_append (app
->messages
, prj_name
, MESSAGE_BUILD
);
83 an_message_manager_append (app
->messages
, " ...\n", MESSAGE_BUILD
);
84 an_message_manager_append (app
->messages
, cmd
, MESSAGE_BUILD
);
85 an_message_manager_append (app
->messages
, "\n", MESSAGE_BUILD
);
86 an_message_manager_append (app
->messages
, "", MESSAGE_BUILD
); // Maybe something is missing here
87 an_message_manager_show (app
->messages
, MESSAGE_BUILD
);
96 gchar
*cmd
, *prj_name
;
98 if(app
->project_dbase
->is_saved
== FALSE
99 && app
->project_dbase
->project_is_open
==TRUE
)
102 ret
= project_dbase_save_project(app
->project_dbase
);
107 if (app
->project_dbase
->project_is_open
)
110 command_editor_get_command (app
->command_editor
,
111 COMMAND_BUILD_CLEAN_ALL
);
115 ("Unable to Clean All for the Project. Check Settings->Commands."));
118 chdir (app
->project_dbase
->top_proj_dir
);
119 if (build_execute_command (cmd
) == FALSE
)
124 anjuta_update_app_status (TRUE
, _("Clean All"));
125 an_message_manager_clear (app
->messages
, MESSAGE_BUILD
);
126 an_message_manager_append (app
->messages
,
127 _("Cleaning whole of the Project: "),
129 prj_name
= project_dbase_get_proj_name (app
->project_dbase
);
130 an_message_manager_append (app
->messages
, prj_name
, MESSAGE_BUILD
);
131 an_message_manager_append (app
->messages
, " ...\n", MESSAGE_BUILD
);
132 an_message_manager_append (app
->messages
, cmd
, MESSAGE_BUILD
);
133 an_message_manager_append (app
->messages
, "\n", MESSAGE_BUILD
);
134 an_message_manager_show (app
->messages
, MESSAGE_BUILD
);