static const char *get_help(struct menu *menu) { if (menu_has_help(menu)) return _(menu_get_help(menu)); else return nohelp_text; }
static void show_help(struct menu *menu) { struct gstr help = str_new(); struct symbol *sym = menu->sym; if (menu_has_help(menu)) { if (sym->name) { str_printf(&help, "%s:\n\n", sym->name); } str_append(&help, _(menu_get_help(menu))); str_append(&help, "\n"); } else if (menu_has_help(sym->prop->menu->parent)) { str_append(&help, _(menu_get_help(sym->prop->menu->parent))); str_append(&help, "\n"); } else { str_append(&help, nohelp_text); } get_symbol_str(&help, sym); show_helptext(_(menu_get_prompt(menu)), str_get(&help)); str_free(&help); }
void menu_get_ext_help(struct menu *menu, struct gstr *help) { struct symbol *sym = menu->sym; const char *help_text = nohelp_text; if (menu_has_help(menu)) { if (sym->name) str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); help_text = menu_get_help(menu); } str_printf(help, "%s\n", _(help_text)); if (sym) get_symbol_str(help, sym, NULL); }
void menu_get_ext_help(struct menu *menu, struct gstr *help) { struct symbol *sym = menu->sym; if (menu_has_help(menu)) { if (sym->name) { str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); str_append(help, _(menu_get_help(menu))); str_append(help, "\n"); } } else { str_append(help, nohelp_text); } if (sym) get_symbol_str(help, sym); }
void menu_build_message_list(struct menu *menu) { struct menu *child; message__add(menu_get_prompt(menu), NULL, menu->file == NULL ? "Root Menu" : menu->file->name, menu->lineno); if (menu->sym != NULL && menu_has_help(menu)) message__add(menu_get_help(menu), menu->sym->name, menu->file == NULL ? "Root Menu" : menu->file->name, menu->lineno); for (child = menu->list; child != NULL; child = child->next) if (child->prompt != NULL) menu_build_message_list(child); }
void print_menu(struct menu *menu) { struct menu *child; struct symbol *sym; for (child = menu->list; child; child = child->next) { sym = child->sym; if (menu_has_help(menu)) { if (sym && sym->name) { printf("%s\n{{{\n", sym->name); printf("%s", _(menu_get_help(menu))); //_( == gettext printf("}}}\n"); } } print_menu(child); } }
static void text_insert_help(struct menu *menu) { GtkTextBuffer *buffer; GtkTextIter start, end; const char *prompt = _(menu_get_prompt(menu)); gchar *name; const char *help; help = menu_get_help(menu); /* Gettextize if the help text not empty */ if ((help != 0) && (help[0] != 0)) help = _(help); if (menu->sym && menu->sym->name) name = g_strdup_printf(menu->sym->name); else name = g_strdup(""); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); gtk_text_buffer_get_bounds(buffer, &start, &end); gtk_text_buffer_delete(buffer, &start, &end); gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, NULL); gtk_text_buffer_insert_at_cursor(buffer, " ", 1); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_with_tags(buffer, &end, name, -1, tag1, NULL); gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); gtk_text_buffer_get_end_iter(buffer, &end); gtk_text_buffer_insert_with_tags(buffer, &end, help, -1, tag2, NULL); }