Revision: 897 http://svn.sourceforge.net/geany/?rev=897&view=rev Author: ntrel Date: 2006-10-16 07:15:04 -0700 (Mon, 16 Oct 2006)
Log Message: ----------- Don't overwrite Make Custom string when using Make Object. Move app->build_make_custopt to build_options struct in build.c.
Modified Paths: -------------- trunk/ChangeLog trunk/src/build.c trunk/src/build.h trunk/src/callbacks.c trunk/src/geany.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-10-16 14:09:20 UTC (rev 896) +++ trunk/ChangeLog 2006-10-16 14:15:04 UTC (rev 897) @@ -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
Modified: trunk/src/build.c =================================================================== --- trunk/src/build.c 2006-10-16 14:09:20 UTC (rev 896) +++ trunk/src/build.c 2006-10-16 14:15:04 UTC (rev 897) @@ -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_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) + argv[0] = g_strdup(app->tools_make_cmd); + + if (build_opts == GBO_MAKE_OBJECT) + { + argv[1] = get_object_filename(idx); + argv[2] = NULL; + } + else if (build_opts == GBO_MAKE_CUSTOM && build_options.custom_target) { //cust-target - argv[0] = g_strdup(app->tools_make_cmd); - argv[1] = g_strdup(app->build_make_custopt); + argv[1] = g_strdup(build_options.custom_target); argv[2] = NULL; } - else + else // GBO_MAKE_ALL { - argv[0] = g_strdup(app->tools_make_cmd); argv[1] = g_strdup("all"); argv[2] = NULL; }
Modified: trunk/src/build.h =================================================================== --- trunk/src/build.h 2006-10-16 14:09:20 UTC (rev 896) +++ trunk/src/build.h 2006-10-16 14:15:04 UTC (rev 897) @@ -24,8 +24,23 @@ #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);
GPid build_link_file(gint idx);
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2006-10-16 14:09:20 UTC (rev 896) +++ trunk/src/callbacks.c 2006-10-16 14:15:04 UTC (rev 897) @@ -1620,52 +1620,34 @@ 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)) { case 1: //custom target { 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 @@
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);
Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2006-10-16 14:09:20 UTC (rev 896) +++ trunk/src/geany.h 2006-10-16 14:15:04 UTC (rev 897) @@ -138,7 +138,6 @@ gchar *configdir; gchar *datadir; gchar *docdir; - gchar *build_make_custopt; gchar *custom_date_format; gchar *tools_browser_cmd; gchar *tools_make_cmd;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.