Don't overwrite Make Custom string when using Make Object.
Move app->build_make_custopt to build_options struct in build.c. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@897 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
219eaf3dcd
commit
3a721f02d1
@ -2,6 +2,9 @@
|
||||
|
||||
* src/keybindings.c: Change goto matching brace default keybinding to
|
||||
CTRL-SHIFT-< (requires shift on some keyboards).
|
||||
* src/build.c, src/build.h, src/geany.h, src/callbacks.c:
|
||||
Don't overwrite Make Custom string when using Make Object.
|
||||
Move app->build_make_custopt to build_options struct in build.c.
|
||||
|
||||
|
||||
2006-10-13 Enrico Tröger <enrico.troeger@uvena.de>
|
||||
|
41
src/build.c
41
src/build.c
@ -44,6 +44,9 @@
|
||||
#include "main.h"
|
||||
|
||||
|
||||
BuildOptions build_options = {NULL};
|
||||
|
||||
|
||||
static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data);
|
||||
static gboolean build_create_shellscript(const gint idx, const gchar *fname, const gchar *cmd);
|
||||
static GPid build_spawn_cmd(gint idx, gchar **cmd);
|
||||
@ -146,22 +149,48 @@ GPid build_view_tex_file(gint idx, gint mode)
|
||||
}
|
||||
|
||||
|
||||
GPid build_make_file(gint idx, gboolean cust_target)
|
||||
static gchar *get_object_filename(gint idx)
|
||||
{
|
||||
gchar *locale_filename, *short_file, *noext, *object_file;
|
||||
|
||||
if (doc_list[idx].file_name == NULL) return NULL;
|
||||
|
||||
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
|
||||
|
||||
short_file = g_path_get_basename(locale_filename);
|
||||
g_free(locale_filename);
|
||||
|
||||
noext = utils_remove_ext_from_filename(short_file);
|
||||
g_free(short_file);
|
||||
|
||||
object_file = g_strdup_printf("%s.o", noext);
|
||||
g_free(noext);
|
||||
|
||||
return object_file;
|
||||
}
|
||||
|
||||
|
||||
GPid build_make_file(gint idx, gint build_opts)
|
||||
{
|
||||
gchar **argv;
|
||||
|
||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||
|
||||
argv = g_new0(gchar*, 3);
|
||||
if (cust_target && app->build_make_custopt)
|
||||
{ //cust-target
|
||||
argv[0] = g_strdup(app->tools_make_cmd);
|
||||
argv[1] = g_strdup(app->build_make_custopt);
|
||||
|
||||
if (build_opts == GBO_MAKE_OBJECT)
|
||||
{
|
||||
argv[1] = get_object_filename(idx);
|
||||
argv[2] = NULL;
|
||||
}
|
||||
else
|
||||
else if (build_opts == GBO_MAKE_CUSTOM && build_options.custom_target)
|
||||
{ //cust-target
|
||||
argv[1] = g_strdup(build_options.custom_target);
|
||||
argv[2] = NULL;
|
||||
}
|
||||
else // GBO_MAKE_ALL
|
||||
{
|
||||
argv[0] = g_strdup(app->tools_make_cmd);
|
||||
argv[1] = g_strdup("all");
|
||||
argv[2] = NULL;
|
||||
}
|
||||
|
17
src/build.h
17
src/build.h
@ -24,7 +24,22 @@
|
||||
#ifndef GEANY_BUILD_H
|
||||
#define GEANY_BUILD_H 1
|
||||
|
||||
GPid build_make_file(gint idx, gboolean cust_target);
|
||||
enum // Geany Build Options
|
||||
{
|
||||
GBO_MAKE_ALL,
|
||||
GBO_MAKE_CUSTOM,
|
||||
GBO_MAKE_OBJECT
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *custom_target;
|
||||
} BuildOptions;
|
||||
|
||||
extern BuildOptions build_options;
|
||||
|
||||
|
||||
GPid build_make_file(gint idx, gint build_opts);
|
||||
|
||||
GPid build_compile_file(gint idx);
|
||||
|
||||
|
@ -1620,7 +1620,10 @@ on_build_make_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
gboolean make_object = FALSE;
|
||||
gint build_opts = GBO_MAKE_ALL;
|
||||
|
||||
//CHECK MENUS DISABLED
|
||||
g_return_if_fail(DOC_IDX_VALID(idx) && doc_list[idx].file_name != NULL);
|
||||
|
||||
switch (GPOINTER_TO_INT(user_data))
|
||||
{
|
||||
@ -1628,44 +1631,23 @@ on_build_make_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
dialogs_show_input(_("Enter custom options for the make tool"),
|
||||
_("Enter custom options here, all entered text is passed to the make command."),
|
||||
app->build_make_custopt,
|
||||
build_options.custom_target,
|
||||
G_CALLBACK(on_make_target_dialog_response),
|
||||
G_CALLBACK(on_make_target_entry_activate));
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: //make object
|
||||
{
|
||||
gchar *locale_filename, *short_file, *noext, *object_file; //temp
|
||||
|
||||
if (doc_list[idx].file_name != NULL)
|
||||
{
|
||||
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
|
||||
|
||||
short_file = g_path_get_basename(locale_filename);
|
||||
g_free(locale_filename);
|
||||
|
||||
noext = utils_remove_ext_from_filename(short_file);
|
||||
g_free(short_file);
|
||||
|
||||
object_file = g_strdup_printf("%s.o", noext);
|
||||
g_free(noext);
|
||||
|
||||
g_free(app->build_make_custopt);
|
||||
app->build_make_custopt = g_strdup(object_file);
|
||||
g_free(object_file);
|
||||
make_object = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
build_opts = GBO_MAKE_OBJECT;
|
||||
// fall through
|
||||
|
||||
case 0: //make all
|
||||
{
|
||||
GPid child_pid;
|
||||
|
||||
if (doc_list[idx].changed) document_save_file(idx, FALSE);
|
||||
|
||||
child_pid = build_make_file(idx, make_object);
|
||||
child_pid = build_make_file(idx, build_opts);
|
||||
if (child_pid != (GPid) 0)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
||||
@ -1740,10 +1722,10 @@ on_make_target_dialog_response (GtkDialog *dialog,
|
||||
|
||||
if (doc_list[idx].changed) document_save_file(idx, FALSE);
|
||||
|
||||
g_free(app->build_make_custopt);
|
||||
app->build_make_custopt = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
|
||||
g_free(build_options.custom_target);
|
||||
build_options.custom_target = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
|
||||
|
||||
child_pid = build_make_file(idx, TRUE);
|
||||
child_pid = build_make_file(idx, GBO_MAKE_CUSTOM);
|
||||
if (child_pid != (GPid) 0)
|
||||
{
|
||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
||||
|
@ -138,7 +138,6 @@ typedef struct MyApp
|
||||
gchar *configdir;
|
||||
gchar *datadir;
|
||||
gchar *docdir;
|
||||
gchar *build_make_custopt;
|
||||
gchar *custom_date_format;
|
||||
gchar *tools_browser_cmd;
|
||||
gchar *tools_make_cmd;
|
||||
|
Loading…
x
Reference in New Issue
Block a user