Remove hardcoded ioregtool in tool menu creation by adding a shortname field in the dTool_t struct. While at it cleanup a bit the names and shrink a bit name field.

This commit is contained in:
riccardom 2009-07-04 08:56:14 +00:00
parent 40ac90fa14
commit b6e6cfd1f0
3 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,9 @@ typedef void (*dTool_closeFn)();
typedef struct typedef struct
{ {
const char name[64]; /* this should be the same name of the action in the gui xml */
const char shortname[16];
const char name[32];
dTool_openFn open; dTool_openFn open;
dTool_updateFn update; dTool_updateFn update;
dTool_closeFn close; dTool_closeFn close;

View File

@ -226,7 +226,7 @@ static const char *ui_description =
" </menu>" " </menu>"
" </menu>" " </menu>"
" <menu action='ToolsMenu'>" " <menu action='ToolsMenu'>"
" <menuitem action='ioregtool'/>" " <menuitem action='ioregs'/>"
" </menu>" " </menu>"
" <menu action='HelpMenu'>" " <menu action='HelpMenu'>"
" <menuitem action='about'/>" " <menuitem action='about'/>"
@ -1682,8 +1682,7 @@ static void desmume_gtk_menu_tools (GtkActionGroup *ag)
gint i; gint i;
for(i = 0; i < dTools_list_size; i++) { for(i = 0; i < dTools_list_size; i++) {
GtkAction *act; GtkAction *act;
//FIXME: remove hardcoded 'ioregtool' from here and in ui_description act = gtk_action_new(dTools_list[i]->shortname, dTools_list[i]->name, NULL, NULL);
act = gtk_action_new("ioregtool", dTools_list[i]->name, NULL, NULL);
g_signal_connect(G_OBJECT(act), "activate", G_CALLBACK(Start_dTool), GINT_TO_POINTER(i)); g_signal_connect(G_OBJECT(act), "activate", G_CALLBACK(Start_dTool), GINT_TO_POINTER(i));
gtk_action_group_add_action(ag, GTK_ACTION(act)); gtk_action_group_add_action(ag, GTK_ACTION(act));
} }

View File

@ -25,6 +25,7 @@
#include "../MMU.h" #include "../MMU.h"
#define SHORTNAME "ioregs"
#define TOOL_NAME "IO regs view" #define TOOL_NAME "IO regs view"
BOOL CPUS [2] = {TRUE, TRUE}; BOOL CPUS [2] = {TRUE, TRUE};
@ -472,6 +473,7 @@ static void open(int ID)
dTool_t dTool_ioregsView = dTool_t dTool_ioregsView =
{ {
SHORTNAME,
TOOL_NAME, TOOL_NAME,
&open, &open,
&update, &update,