Factor with add_build_command_widgets().

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/build-system@3177 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-11-05 16:49:44 +00:00
parent 20da51a418
commit 55c66f8d37
2 changed files with 31 additions and 20 deletions

View File

@ -2,6 +2,8 @@
* src/build.c: * src/build.c:
Fix warning with -Wall -Wextra. Fix warning with -Wall -Wextra.
* src/build.c:
Factor with add_build_command_widgets().
2008-111-01 Lex Trotman <elextr(at)gmail(dot)com> 2008-111-01 Lex Trotman <elextr(at)gmail(dot)com>

View File

@ -1591,30 +1591,12 @@ on_includes_arguments_dialog_response (GtkDialog *dialog,
} }
static void show_includes_arguments_gen(void) static void add_build_command_widgets(GtkWidget *dialog, GtkWidget *vbox, GeanyFiletype *ft)
{ {
GtkWidget *dialog, *label, *entries[3], *vbox, *build_entry; GtkWidget *label, *entries[3], *build_entry;
GtkWidget *ft_table = NULL; GtkWidget *ft_table = NULL;
GtkWidget *pr_table = NULL; GtkWidget *pr_table = NULL;
gint row = 0; gint row = 0;
gint response;
GeanyDocument *doc = document_get_current();
GeanyFiletype *ft = NULL;
if (doc != NULL)
ft = doc->file_type;
g_return_if_fail(ft != NULL);
dialog = gtk_dialog_new_with_buttons(_("Build Menu Commands"), GTK_WINDOW(main_widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
gtk_widget_set_name(dialog, "GeanyDialog");
label = gtk_label_new(_("Set the commands for the build menu."));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_container_add(GTK_CONTAINER(vbox), label);
if (ft->actions->can_compile || ft->actions->can_link || ft->actions->can_exec) if (ft->actions->can_compile || ft->actions->can_link || ft->actions->can_exec)
{ {
@ -1777,6 +1759,32 @@ static void show_includes_arguments_gen(void)
gtk_widget_ref(build_entry), (GDestroyNotify)gtk_widget_unref); gtk_widget_ref(build_entry), (GDestroyNotify)gtk_widget_unref);
} }
}
static void show_includes_arguments_gen(void)
{
GtkWidget *dialog, *label, *vbox;
gint response;
GeanyDocument *doc = document_get_current();
GeanyFiletype *ft = NULL;
if (doc != NULL)
ft = doc->file_type;
g_return_if_fail(ft != NULL);
dialog = gtk_dialog_new_with_buttons(_("Build Menu Commands"), GTK_WINDOW(main_widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
gtk_widget_set_name(dialog, "GeanyDialog");
label = gtk_label_new(_("Set the commands for the build menu."));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_container_add(GTK_CONTAINER(vbox), label);
add_build_command_widgets(dialog, vbox, ft);
label = gtk_label_new(_("%f will be replaced by the current filename, e.g. test_file.c\n" label = gtk_label_new(_("%f will be replaced by the current filename, e.g. test_file.c\n"
"%e will be replaced by the filename without extension, e.g. test_file")); "%e will be replaced by the filename without extension, e.g. test_file"));
@ -1856,6 +1864,7 @@ void build_menu_update(GeanyDocument *doc)
can_build = can_make && ! is_c_header(doc->file_name); can_build = can_make && ! is_c_header(doc->file_name);
else else
can_build = can_make; can_build = can_make;
if (menu_items->item_compile) if (menu_items->item_compile)
gtk_widget_set_sensitive(menu_items->item_compile, can_build && ft->actions->can_compile); gtk_widget_set_sensitive(menu_items->item_compile, can_build && ft->actions->can_compile);
if (menu_items->item_link) if (menu_items->item_link)