update gtk frontend menu structure to be more standard

This commit is contained in:
Vincent Sanders 2014-07-23 20:34:29 +01:00
parent 418925fa4b
commit 235f3f6c57
6 changed files with 134 additions and 92 deletions

View File

@ -249,25 +249,28 @@ static struct nsgtk_toolbars_submenu *nsgtk_menu_toolbars_submenu(
* \param group the 'global' in a gtk sense accelerator reference
*/
static struct nsgtk_debugging_submenu *nsgtk_menu_debugging_submenu(
static struct nsgtk_developer_submenu *nsgtk_menu_developer_submenu(
GtkAccelGroup *group)
{
struct nsgtk_debugging_submenu *ret =
malloc(sizeof(struct nsgtk_debugging_submenu));
if (ret == NULL) {
struct nsgtk_developer_submenu *dmenu =
malloc(sizeof(struct nsgtk_developer_submenu));
if (dmenu == NULL) {
warn_user(messages_get("NoMemory"), 0);
return NULL;
}
ret->debugging_menu = GTK_MENU(gtk_menu_new());
if (ret->debugging_menu == NULL) {
dmenu->developer_menu = GTK_MENU(gtk_menu_new());
if (dmenu->developer_menu == NULL) {
warn_user(messages_get("NoMemory"), 0);
free(ret);
free(dmenu);
return NULL;
}
IMAGE_ITEM(debugging, toggledebugging, gtkToggleDebugging, ret, group);
IMAGE_ITEM(debugging, saveboxtree, gtkSaveBoxTree, ret, group);
IMAGE_ITEM(debugging, savedomtree, gtkSaveDomTree, ret, group);
return ret;
IMAGE_ITEM(developer, viewsource, gtkPageSource, dmenu, group);
IMAGE_ITEM(developer, toggledebugging, gtkToggleDebugging, dmenu, group);
IMAGE_ITEM(developer, debugboxtree, gtkDebugBoxTree, dmenu, group);
IMAGE_ITEM(developer, debugdomtree, gtkDebugDomTree, dmenu, group);
return dmenu;
}
/**
@ -364,20 +367,16 @@ static struct nsgtk_view_menu *nsgtk_menu_view_submenu(GtkAccelGroup *group)
ADD_SEP(view, ret);
IMAGE_ITEM(view, scaleview, gtkScaleView, ret, group);
IMAGE_ITEM(view, fullscreen, gtkFullScreen, ret, group);
IMAGE_ITEM(view, viewsource, gtkViewSource, ret, group);
ADD_SEP(view, ret);
IMAGE_ITEM(view, images, gtkImages, ret, group);
IMAGE_ITEM(view, toolbars, gtkToolbars, ret, group);
IMAGE_ITEM(view, tabs, gtkTabs, ret, group);
ADD_SEP(view, ret);
IMAGE_ITEM(view, downloads, gtkDownloads, ret, group);
IMAGE_ITEM(view, savewindowsize, gtkSaveWindowSize, ret, group);
IMAGE_ITEM(view, debugging, gtkDebugging, ret, group);
SET_SUBMENU(scaleview, ret);
SET_SUBMENU(images, ret);
SET_SUBMENU(toolbars, ret);
SET_SUBMENU(tabs, ret);
SET_SUBMENU(debugging, ret);
return ret;
@ -412,19 +411,42 @@ static struct nsgtk_nav_menu *nsgtk_menu_nav_submenu(GtkAccelGroup *group)
IMAGE_ITEM(nav, addbookmarks, gtkAddBookMarks, ret, group);
IMAGE_ITEM(nav, showbookmarks, gtkShowBookMarks, ret, group);
ADD_SEP(nav, ret);
IMAGE_ITEM(nav, showcookies, gtkShowCookies, ret, group);
ADD_SEP(nav, ret);
IMAGE_ITEM(nav, openlocation, gtkOpenLocation, ret, group);
return ret;
}
/**
* creates the tools menu
* \param group the 'global' in a gtk sense accelerator reference
*/
static struct nsgtk_tools_menu *nsgtk_menu_tools_submenu(GtkAccelGroup *group)
{
struct nsgtk_tools_menu *ret = malloc(sizeof(struct nsgtk_tools_menu));
if (ret == NULL) {
warn_user(messages_get("NoMemory"), 0);
return NULL;
}
ret->tools_menu = GTK_MENU(gtk_menu_new());
if (ret->tools_menu == NULL) {
warn_user(messages_get("NoMemory"), 0);
free(ret);
return NULL;
}
IMAGE_ITEM(tools, downloads, gtkDownloads, ret, group);
IMAGE_ITEM(tools, showcookies, gtkShowCookies, ret, group);
IMAGE_ITEM(tools, developer, gtkDeveloper, ret, group);
SET_SUBMENU(developer, ret);
return ret;
}
/**
* creates a help menu
* \param group the 'global' in a gtk sense accelerator reference
*/
static struct nsgtk_help_menu *nsgtk_menu_help_submenu(GtkAccelGroup *group)
{
struct nsgtk_help_menu *ret = malloc(sizeof(struct nsgtk_help_menu));
@ -468,6 +490,7 @@ nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkAccelGroup *group)
nmenu->edit_submenu = nsgtk_menu_edit_submenu(group);
nmenu->view_submenu = nsgtk_menu_view_submenu(group);
nmenu->nav_submenu = nsgtk_menu_nav_submenu(group);
nmenu->tools_submenu = nsgtk_menu_tools_submenu(group);
nmenu->help_submenu = nsgtk_menu_help_submenu(group);
if (menubar != NULL) {
@ -478,6 +501,7 @@ nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkAccelGroup *group)
ATTACH_PARENT(menubar, gtkEdit, nmenu->edit_submenu->edit, group);
ATTACH_PARENT(menubar, gtkView, nmenu->view_submenu->view, group);
ATTACH_PARENT(menubar, gtkNavigate, nmenu->nav_submenu->nav, group);
ATTACH_PARENT(menubar, gtkTools, nmenu->tools_submenu->tools, group);
ATTACH_PARENT(menubar, gtkHelp, nmenu->help_submenu->help, group);
}
@ -503,6 +527,9 @@ struct nsgtk_popup_menu *nsgtk_popup_menu_create(GtkAccelGroup *group)
IMAGE_ITEM(popup, nav, gtkNavigate, nmenu, group);
SET_SUBMENU(nav, nmenu);
IMAGE_ITEM(popup, tools, gtkTools, nmenu, group);
SET_SUBMENU(tools, nmenu);
IMAGE_ITEM(popup, help, gtkHelp, nmenu, group);
SET_SUBMENU(help, nmenu);

View File

@ -55,17 +55,13 @@ struct nsgtk_view_menu {
GtkImageMenuItem *scaleview_menuitem;
struct nsgtk_scaleview_submenu *scaleview_submenu;
GtkImageMenuItem *fullscreen_menuitem;
GtkImageMenuItem *viewsource_menuitem;
GtkImageMenuItem *images_menuitem;
struct nsgtk_images_submenu *images_submenu;
GtkImageMenuItem *toolbars_menuitem;
struct nsgtk_toolbars_submenu *toolbars_submenu;
GtkImageMenuItem *tabs_menuitem;
struct nsgtk_tabs_submenu *tabs_submenu;
GtkImageMenuItem *downloads_menuitem;
GtkImageMenuItem *savewindowsize_menuitem;
GtkImageMenuItem *debugging_menuitem;
struct nsgtk_debugging_submenu *debugging_submenu;
};
struct nsgtk_nav_menu {
@ -78,10 +74,19 @@ struct nsgtk_nav_menu {
GtkImageMenuItem *globalhistory_menuitem;
GtkImageMenuItem *addbookmarks_menuitem;
GtkImageMenuItem *showbookmarks_menuitem;
GtkImageMenuItem *showcookies_menuitem;
GtkImageMenuItem *openlocation_menuitem;
};
struct nsgtk_tools_menu {
GtkMenuItem *tools; /* Tools menu item on menubar */
GtkMenu *tools_menu;
GtkImageMenuItem *showcookies_menuitem;
GtkImageMenuItem *downloads_menuitem;
GtkImageMenuItem *developer_menuitem;
struct nsgtk_developer_submenu *developer_submenu;
};
struct nsgtk_help_menu {
GtkMenuItem *help; /* Help menu item on menubar */
GtkMenu *help_menu;
@ -91,6 +96,7 @@ struct nsgtk_help_menu {
GtkImageMenuItem *about_menuitem;
};
struct nsgtk_export_submenu {
GtkMenu *export_menu;
GtkImageMenuItem *plaintext_menuitem;
@ -125,11 +131,13 @@ struct nsgtk_toolbars_submenu {
GtkCheckMenuItem *toolbar_menuitem;
};
struct nsgtk_debugging_submenu {
GtkMenu *debugging_menu;
struct nsgtk_developer_submenu {
GtkMenu *developer_menu;
GtkImageMenuItem *viewsource_menuitem;
GtkImageMenuItem *toggledebugging_menuitem;
GtkImageMenuItem *saveboxtree_menuitem;
GtkImageMenuItem *savedomtree_menuitem;
GtkImageMenuItem *debugboxtree_menuitem;
GtkImageMenuItem *debugdomtree_menuitem;
};
@ -139,7 +147,8 @@ struct nsgtk_bar_submenu {
struct nsgtk_edit_menu *edit_submenu;
struct nsgtk_view_menu *view_submenu;
struct nsgtk_nav_menu *nav_submenu;
struct nsgtk_tabs_menu *tabs_submenu;
struct nsgtk_tabs_submenu *tabs_submenu;
struct nsgtk_tools_menu *tools_submenu;
struct nsgtk_help_menu *help_submenu;
};
@ -159,7 +168,10 @@ struct nsgtk_popup_menu {
struct nsgtk_nav_menu *nav_submenu;
GtkImageMenuItem *tabs_menuitem;
struct nsgtk_tabs_menu *tabs_submenu;
struct nsgtk_tabs_submenu *tabs_submenu;
GtkImageMenuItem *tools_menuitem;
struct nsgtk_tools_menu *tools_submenu;
GtkImageMenuItem *help_menuitem;
struct nsgtk_help_menu *help_submenu;

View File

@ -1289,7 +1289,7 @@ MULTIHANDLER(toggledebugging)
return TRUE;
}
MULTIHANDLER(saveboxtree)
MULTIHANDLER(debugboxtree)
{
GtkWidget *save_dialog;
@ -1333,7 +1333,7 @@ MULTIHANDLER(saveboxtree)
return TRUE;
}
MULTIHANDLER(savedomtree)
MULTIHANDLER(debugdomtree)
{
GtkWidget *save_dialog;
@ -2644,18 +2644,12 @@ void nsgtk_scaffolding_toolbar_size_allocate(GtkWidget *widget,
void nsgtk_scaffolding_toolbar_init(struct gtk_scaffolding *g)
{
#define ITEM_MAIN(p, q, r)\
g->buttons[p##_BUTTON]->main =\
g->menu_bar->q->r##_menuitem;\
g->buttons[p##_BUTTON]->rclick =\
g->menu_popup->q->r##_menuitem;\
g->buttons[p##_BUTTON]->mhandler =\
nsgtk_on_##r##_activate_menu;\
g->buttons[p##_BUTTON]->bhandler =\
nsgtk_on_##r##_activate_button;\
g->buttons[p##_BUTTON]->dataplus =\
nsgtk_toolbar_##r##_button_data;\
g->buttons[p##_BUTTON]->dataminus =\
nsgtk_toolbar_##r##_toolbar_button_data
g->buttons[p##_BUTTON]->main = g->menu_bar->q->r##_menuitem;\
g->buttons[p##_BUTTON]->rclick = g->menu_popup->q->r##_menuitem;\
g->buttons[p##_BUTTON]->mhandler = nsgtk_on_##r##_activate_menu;\
g->buttons[p##_BUTTON]->bhandler = nsgtk_on_##r##_activate_button;\
g->buttons[p##_BUTTON]->dataplus = nsgtk_toolbar_##r##_button_data;\
g->buttons[p##_BUTTON]->dataminus = nsgtk_toolbar_##r##_toolbar_button_data
#define ITEM_SUB(p, q, r, s)\
g->buttons[p##_BUTTON]->main =\
@ -2691,6 +2685,7 @@ void nsgtk_scaffolding_toolbar_init(struct gtk_scaffolding *g)
nsgtk_toolbar_##q##_button_data;\
g->buttons[p##_ITEM]->dataminus =\
nsgtk_toolbar_##q##_toolbar_button_data
ITEM_ITEM(WEBSEARCH, websearch);
ITEM_ITEM(THROBBER, throbber);
ITEM_MAIN(NEWWINDOW, file_submenu, newwindow);
@ -2714,8 +2709,7 @@ void nsgtk_scaffolding_toolbar_init(struct gtk_scaffolding *g)
ITEM_MAIN(RELOAD, view_submenu, reload);
ITEM_POP(RELOAD, reload);
ITEM_MAIN(FULLSCREEN, view_submenu, fullscreen);
ITEM_MAIN(VIEWSOURCE, view_submenu, viewsource);
ITEM_MAIN(DOWNLOADS, view_submenu, downloads);
ITEM_MAIN(DOWNLOADS, tools_submenu, downloads);
ITEM_MAIN(SAVEWINDOWSIZE, view_submenu, savewindowsize);
ITEM_MAIN(BACK, nav_submenu, back);
ITEM_POP(BACK, back);
@ -2726,7 +2720,7 @@ void nsgtk_scaffolding_toolbar_init(struct gtk_scaffolding *g)
ITEM_MAIN(GLOBALHISTORY, nav_submenu, globalhistory);
ITEM_MAIN(ADDBOOKMARKS, nav_submenu, addbookmarks);
ITEM_MAIN(SHOWBOOKMARKS, nav_submenu, showbookmarks);
ITEM_MAIN(SHOWCOOKIES, nav_submenu, showcookies);
ITEM_MAIN(SHOWCOOKIES, tools_submenu, showcookies);
ITEM_MAIN(OPENLOCATION, nav_submenu, openlocation);
ITEM_MAIN(CONTENTS, help_submenu, contents);
ITEM_MAIN(INFO, help_submenu, info);
@ -2742,10 +2736,14 @@ void nsgtk_scaffolding_toolbar_init(struct gtk_scaffolding *g)
ITEM_SUB(NEXTTAB, view_submenu, tabs, nexttab);
ITEM_SUB(PREVTAB, view_submenu, tabs, prevtab);
ITEM_SUB(CLOSETAB, view_submenu, tabs, closetab);
ITEM_SUB(TOGGLEDEBUGGING, view_submenu, debugging, toggledebugging);
ITEM_SUB(SAVEBOXTREE, view_submenu, debugging, saveboxtree);
ITEM_SUB(SAVEDOMTREE, view_submenu, debugging, savedomtree);
/* development submenu */
ITEM_SUB(VIEWSOURCE, tools_submenu, developer, viewsource);
ITEM_SUB(TOGGLEDEBUGGING, tools_submenu, developer, toggledebugging);
ITEM_SUB(SAVEBOXTREE, tools_submenu, developer, debugboxtree);
ITEM_SUB(SAVEDOMTREE, tools_submenu, developer, debugdomtree);
ITEM_BUTTON(HISTORY, history);
/* disable items that make no sense initially, as well as
* as-yet-unimplemented items */
SENSITIVITY(BACK);

View File

@ -807,8 +807,8 @@ GtkWidget *nsgtk_toolbar_make_widget(nsgtk_scaffolding *g,
MAKE_MENUBUTTON(DOWNLOADS, gtkDownloads)
MAKE_MENUBUTTON(SAVEWINDOWSIZE, gtkSaveWindowSize)
MAKE_MENUBUTTON(TOGGLEDEBUGGING, gtkToggleDebugging)
MAKE_MENUBUTTON(SAVEBOXTREE, gtkSaveBoxTree)
MAKE_MENUBUTTON(SAVEDOMTREE, gtkSaveDomTree)
MAKE_MENUBUTTON(SAVEBOXTREE, gtkDebugBoxTree)
MAKE_MENUBUTTON(SAVEDOMTREE, gtkDebugDomTree)
MAKE_MENUBUTTON(LOCALHISTORY, gtkLocalHistory)
MAKE_MENUBUTTON(GLOBALHISTORY, gtkGlobalHistory)
MAKE_MENUBUTTON(ADDBOOKMARKS, gtkAddBookMarks)
@ -972,8 +972,8 @@ DATAHANDLER(find, FIND, window)
DATAHANDLER(downloads, DOWNLOADS, window)
DATAHANDLER(savewindowsize, SAVEWINDOWSIZE, window)
DATAHANDLER(toggledebugging, TOGGLEDEBUGGING, window)
DATAHANDLER(saveboxtree, SAVEBOXTREE, window)
DATAHANDLER(savedomtree, SAVEDOMTREE, window)
DATAHANDLER(debugboxtree, SAVEBOXTREE, window)
DATAHANDLER(debugdomtree, SAVEDOMTREE, window)
DATAHANDLER(localhistory, LOCALHISTORY, window)
DATAHANDLER(globalhistory, GLOBALHISTORY, window)
DATAHANDLER(addbookmarks, ADDBOOKMARKS, window)

View File

@ -81,8 +81,8 @@ TOOLPROTO(nexttab);
TOOLPROTO(prevtab);
TOOLPROTO(savewindowsize);
TOOLPROTO(toggledebugging);
TOOLPROTO(saveboxtree);
TOOLPROTO(savedomtree);
TOOLPROTO(debugboxtree);
TOOLPROTO(debugdomtree);
TOOLPROTO(contents);
TOOLPROTO(guide);
TOOLPROTO(info);

View File

@ -1760,11 +1760,11 @@ de.gtk.gtkNavigate:_Navigation
fr.gtk.gtkNavigate:_Navigate
it.gtk.gtkNavigate:_Visualizza
nl.gtk.gtkNavigate:_Navigate
en.gtk.gtkTabs:_Tabs
de.gtk.gtkTabs:_Tabs
fr.gtk.gtkTabs:_Tabs
it.gtk.gtkTabs:_Schede
nl.gtk.gtkTabs:_Tabs
en.gtk.gtkTools:_Tools
de.gtk.gtkTools:_Tools
fr.gtk.gtkTools:_Tools
it.gtk.gtkTools:_Tools
nl.gtk.gtkTools:_Tools
en.gtk.gtkHelp:_Help
de.gtk.gtkHelp:_Hilfe
fr.gtk.gtkHelp:_Help
@ -2003,16 +2003,16 @@ de.gtk.gtkFullScreenAccel:F11
fr.gtk.gtkFullScreenAccel:F11
it.gtk.gtkFullScreenAccel:F11
nl.gtk.gtkFullScreenAccel:F11
en.gtk.gtkViewSource:View S_ource
de.gtk.gtkViewSource: Q_uelltext Anzeigen
fr.gtk.gtkViewSource:Voir la S_ource
it.gtk.gtkViewSource:Mostra s_orgente
nl.gtk.gtkViewSource:View S_ource
en.gtk.gtkViewSourceAccel:F8
de.gtk.gtkViewSourceAccel:F8
fr.gtk.gtkViewSourceAccel:F8
it.gtk.gtkViewSourceAccel:F8
nl.gtk.gtkViewSourceAccel:F8
en.gtk.gtkPageSource:Page S_ource
de.gtk.gtkPageSource: Q_uelltext Anzeigen
fr.gtk.gtkPageSource:Voir la S_ource
it.gtk.gtkPageSource:Mostra s_orgente
nl.gtk.gtkPageSource:Page S_ource
en.gtk.gtkPageSourceAccel:<ctrl>U
de.gtk.gtkPageSourceAccel:<ctrl>U
fr.gtk.gtkPageSourceAccel:<ctrl>U
it.gtk.gtkPageSourceAccel:<ctrl>U
nl.gtk.gtkPageSourceAccel:<ctrl>U
en.gtk.gtkImages:_Images
de.gtk.gtkImages:B_ilder
fr.gtk.gtkImages:_Images
@ -2033,6 +2033,11 @@ de.gtk.gtkToolbars:_Werkzeugleisten
fr.gtk.gtkToolbars:_Barre d'outils
it.gtk.gtkToolbars:_Barre strumenti
nl.gtk.gtkToolbars:_Toolbars
en.gtk.gtkTabs:_Tabs
de.gtk.gtkTabs:_Tabs
fr.gtk.gtkTabs:_Tabs
it.gtk.gtkTabs:_Schede
nl.gtk.gtkTabs:_Tabs
en.gtk.gtkMenuBar:_Menu Bar
de.gtk.gtkMenuBar:_Menüleiste
fr.gtk.gtkMenuBar:_Barre de menu
@ -2048,11 +2053,11 @@ de.gtk.gtkStatusBar:_Statusleiste
fr.gtk.gtkStatusBar:_Bar de statut
it.gtk.gtkStatusBar:Barra di s_tato
nl.gtk.gtkStatusBar:_Status Bar
en.gtk.gtkDownloads:_Downloads
de.gtk.gtkDownloads:_Downloads
fr.gtk.gtkDownloads:_Téléchargements
it.gtk.gtkDownloads:_Trasferimenti
nl.gtk.gtkDownloads:_Downloads
en.gtk.gtkDownloads:_Downloads...
de.gtk.gtkDownloads:_Downloads...
fr.gtk.gtkDownloads:_Téléchargements...
it.gtk.gtkDownloads:_Trasferimenti...
nl.gtk.gtkDownloads:_Downloads...
en.gtk.gtkDownloadsAccel:<ctrl>d
de.gtk.gtkDownloadsAccel:<ctrl>d
fr.gtk.gtkDownloadsAccel:<ctrl>d
@ -2063,26 +2068,26 @@ de.gtk.gtkSaveWindowSize:Fenstergröße _speichern
fr.gtk.gtkSaveWindowSize:E_nregistrer la taille de la fenêtre
it.gtk.gtkSaveWindowSize:S_alva dimensione finestra
nl.gtk.gtkSaveWindowSize:S_ave Window Size
en.gtk.gtkDebugging:De_bugging
de.gtk.gtkDebugging:De_bugging
fr.gtk.gtkDebugging:D_ébogage
it.gtk.gtkDebugging:De_bugging
nl.gtk.gtkDebugging:De_bugging
en.gtk.gtkDeveloper:De_veloper
de.gtk.gtkDeveloper:De_veloper
fr.gtk.gtkDeveloper:D_ébogage
it.gtk.gtkDeveloper:De_veloper
nl.gtk.gtkDeveloper:De_veloper
en.gtk.gtkToggleDebugging:T_oggle debug rendering
de.gtk.gtkToggleDebugging:T_oggle debug rendering
fr.gtk.gtkToggleDebugging:Activer le débogage
it.gtk.gtkToggleDebugging:In_verti debug del rendering
nl.gtk.gtkToggleDebugging:T_oggle debug rendering
en.gtk.gtkSaveBoxTree:_Save box tree
de.gtk.gtkSaveBoxTree:_Save box tree
fr.gtk.gtkSaveBoxTree:_Save box tree
it.gtk.gtkSaveBoxTree:_Salva albero Box
nl.gtk.gtkSaveBoxTree:_Save box tree
en.gtk.gtkSaveDomTree:Save DOM tree
de.gtk.gtkSaveDomTree:Save DOM tree
fr.gtk.gtkSaveDomTree:Save DOM tree
it.gtk.gtkSaveDomTree:Salva albero DOM
nl.gtk.gtkSaveDomTree:Save DOM tree
en.gtk.gtkDebugBoxTree:Debug _box tree
de.gtk.gtkDebugBoxTree:Debug _box tree
fr.gtk.gtkDebugBoxTree:Debug _box tree
it.gtk.gtkDebugBoxTree:Debug _box tree
nl.gtk.gtkDebugBoxTree:Debug _box tree
en.gtk.gtkDebugDomTree:Debug _DOM tree
de.gtk.gtkDebugDomTree:Debug _DOM tree
fr.gtk.gtkDebugDomTree:Debug _DOM tree
it.gtk.gtkDebugDomTree:Debug albero _DOM
nl.gtk.gtkDebugDomTree:Debug _DOM tree
en.gtk.gtkBack:_Back
de.gtk.gtkBack:_Zurück