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
|
* src/keybindings.c: Change goto matching brace default keybinding to
|
||||||
CTRL-SHIFT-< (requires shift on some keyboards).
|
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>
|
2006-10-13 Enrico Tröger <enrico.troeger@uvena.de>
|
||||||
|
43
src/build.c
43
src/build.c
@ -44,6 +44,9 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
|
BuildOptions build_options = {NULL};
|
||||||
|
|
||||||
|
|
||||||
static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data);
|
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 gboolean build_create_shellscript(const gint idx, const gchar *fname, const gchar *cmd);
|
||||||
static GPid build_spawn_cmd(gint idx, 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;
|
gchar **argv;
|
||||||
|
|
||||||
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
|
||||||
|
|
||||||
argv = g_new0(gchar*, 3);
|
argv = g_new0(gchar*, 3);
|
||||||
if (cust_target && app->build_make_custopt)
|
argv[0] = g_strdup(app->tools_make_cmd);
|
||||||
{ //cust-target
|
|
||||||
argv[0] = g_strdup(app->tools_make_cmd);
|
if (build_opts == GBO_MAKE_OBJECT)
|
||||||
argv[1] = g_strdup(app->build_make_custopt);
|
{
|
||||||
|
argv[1] = get_object_filename(idx);
|
||||||
argv[2] = NULL;
|
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[1] = g_strdup("all");
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
}
|
}
|
||||||
|
17
src/build.h
17
src/build.h
@ -24,7 +24,22 @@
|
|||||||
#ifndef GEANY_BUILD_H
|
#ifndef GEANY_BUILD_H
|
||||||
#define GEANY_BUILD_H 1
|
#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);
|
GPid build_compile_file(gint idx);
|
||||||
|
|
||||||
|
@ -1620,7 +1620,10 @@ on_build_make_activate (GtkMenuItem *menuitem,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gint idx = document_get_cur_idx();
|
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))
|
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"),
|
dialogs_show_input(_("Enter custom options for the make tool"),
|
||||||
_("Enter custom options here, all entered text is passed to the make command."),
|
_("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_dialog_response),
|
||||||
G_CALLBACK(on_make_target_entry_activate));
|
G_CALLBACK(on_make_target_entry_activate));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2: //make object
|
case 2: //make object
|
||||||
{
|
build_opts = GBO_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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case 0: //make all
|
case 0: //make all
|
||||||
{
|
{
|
||||||
GPid child_pid;
|
GPid child_pid;
|
||||||
|
|
||||||
if (doc_list[idx].changed) document_save_file(idx, FALSE);
|
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)
|
if (child_pid != (GPid) 0)
|
||||||
{
|
{
|
||||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
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);
|
if (doc_list[idx].changed) document_save_file(idx, FALSE);
|
||||||
|
|
||||||
g_free(app->build_make_custopt);
|
g_free(build_options.custom_target);
|
||||||
app->build_make_custopt = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
|
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)
|
if (child_pid != (GPid) 0)
|
||||||
{
|
{
|
||||||
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
gtk_widget_set_sensitive(app->compile_button, FALSE);
|
||||||
|
@ -138,7 +138,6 @@ typedef struct MyApp
|
|||||||
gchar *configdir;
|
gchar *configdir;
|
||||||
gchar *datadir;
|
gchar *datadir;
|
||||||
gchar *docdir;
|
gchar *docdir;
|
||||||
gchar *build_make_custopt;
|
|
||||||
gchar *custom_date_format;
|
gchar *custom_date_format;
|
||||||
gchar *tools_browser_cmd;
|
gchar *tools_browser_cmd;
|
||||||
gchar *tools_make_cmd;
|
gchar *tools_make_cmd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user