Kaydet (Commit) 6ddd4496 authored tarafından Nick Treleaven's avatar Nick Treleaven

Add Make object command to compile the current file. Added some separators and…

Add Make object command to compile the current file. Added some separators and renamed Build with make items

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@535 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 7c3ff94f
......@@ -2,6 +2,9 @@
* src/sciwrappers.c: Make sci_goto_line_scroll work better with
line wrapping and folding.
* src/callbacks.c, src/dialogs.c:
Add Make object command to compile the current file.
Added some separators and renamed Build with make items.
2006-07-03 Nick Treleaven <nick.treleaven@btinternet.com>
......
......@@ -1665,22 +1665,49 @@ on_build_make_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gint idx = document_get_cur_idx();
gboolean make_object = FALSE;
if (GPOINTER_TO_INT(user_data) == 1)
switch (GPOINTER_TO_INT(user_data))
{
case 1: //custom target
dialogs_show_make_target();
}
else
{
GPid child_pid;
break;
if (doc_list[idx].changed) document_save_file(idx);
case 2: //make object
{
gchar *locale_filename, *short_file, *noext, *object_file; //temp
locale_filename = g_locale_from_utf8(doc_list[idx].file_name,
-1, NULL, NULL, NULL);
if (locale_filename == NULL)
locale_filename = g_strdup(doc_list[idx].file_name);
child_pid = build_make_file(idx, FALSE);
if (child_pid != (GPid) 0)
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_strlcpy(app->build_make_custopt, object_file, 255);
g_free(object_file);
make_object = TRUE;
}
// fall through
case 0: //make all
{
gtk_widget_set_sensitive(app->compile_button, FALSE);
g_child_watch_add(child_pid, build_exit_cb, NULL);
GPid child_pid;
if (doc_list[idx].changed) document_save_file(idx);
child_pid = build_make_file(idx, make_object);
if (child_pid != (GPid) 0)
{
gtk_widget_set_sensitive(app->compile_button, FALSE);
g_child_watch_add(child_pid, build_exit_cb, NULL);
}
}
}
}
......
......@@ -494,7 +494,7 @@ void dialogs_show_color(void)
GtkWidget *dialogs_create_build_menu_gen(gint idx)
{
GtkWidget *menu, *item, *image, *separator;
GtkWidget *menu, *item = NULL, *image, *separator;
GtkAccelGroup *accel_group = gtk_accel_group_new();
GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
filetype *ft = doc_list[idx].file_type;
......@@ -532,8 +532,15 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
ft->menu_items->item_link = item;
}
if (item != NULL)
{
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
}
// build the code with make all
item = gtk_image_menu_item_new_with_mnemonic(_("Build with \"make\""));
item = gtk_image_menu_item_new_with_mnemonic(_("_Make all"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item, _("Builds the current file with the "
......@@ -544,7 +551,7 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(0));
// build the code with make
item = gtk_image_menu_item_new_with_mnemonic(_("Build with \"_make\" (custom _target)"));
item = gtk_image_menu_item_new_with_mnemonic(_("Make custom _target"));
gtk_widget_show(item);
if (keys[GEANY_KEYS_BUILD_MAKEOWNTARGET]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_MAKEOWNTARGET]->key,
......@@ -554,8 +561,20 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
"make tool and the specified target"), NULL);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(1));
// build the code with make object
item = gtk_image_menu_item_new_with_mnemonic(_("Make _object"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
gtk_tooltips_set_tip(tooltips, item, _("Compiles the current file using the "
"make tool"), NULL);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(2));
if (ft->menu_items->can_exec)
{ // execute the code
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
item = gtk_image_menu_item_new_from_stock("gtk-execute", accel_group);
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
......@@ -576,7 +595,7 @@ GtkWidget *dialogs_create_build_menu_gen(gint idx)
gtk_container_add(GTK_CONTAINER(menu), separator);
gtk_widget_set_sensitive(separator, FALSE);
item = gtk_image_menu_item_new_with_mnemonic(_("Set Includes and Arguments"));
item = gtk_image_menu_item_new_with_mnemonic(_("_Set Includes and Arguments"));
gtk_widget_show(item);
if (keys[GEANY_KEYS_BUILD_OPTIONS]->key)
gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_OPTIONS]->key,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment