From d21213ef38b2027e3ac668d6906d0ff439b1885a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 31 Mar 2018 19:18:58 +0200 Subject: Use GResource for app menu and menu bar --- src/colloquium.c | 204 ++----------------------------------------------------- 1 file changed, 5 insertions(+), 199 deletions(-) (limited to 'src/colloquium.c') diff --git a/src/colloquium.c b/src/colloquium.c index 3e49535..63cacc8 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -327,216 +327,22 @@ static void colloquium_startup(GApplication *papp) g_action_map_add_action_entries(G_ACTION_MAP(app), app_entries, G_N_ELEMENTS(app_entries), app); - builder = gtk_builder_new(); - gtk_builder_add_from_string(builder, - "" - - " " - "
" - " " - " _New" - " app.new" - " <Primary>n" - " " - " " - " _Open..." - " app.open" - " <Primary>o" - " " - " " - " Preferences" - " app.prefs" - " " - "
" - "
" - " " - " _About" - " app.about" - " " - " " - " _Quit" - " app.quit" - " <Primary>q" - " " - "
" - "
" - - " " - " " - " File" - - "
" - " " - " _New" - " app.new" - " <Primary>n" - " " - " " - " _Open..." - " app.open" - " <Primary>o" - " " - "
" - "
" - " " - " _Save" - " win.save" - " <Primary>s" - " " - " " - " Save As..." - " win.saveas" - " " - "
" - "
" - " " - " Print..." - " win.print" - " " - " " - " Export slides as PDF..." - " win.exportpdf" - " " - "
" - "
" - " " - " Load stylesheet..." - " win.loadstyle" - " " - " " - " Save stylesheet..." - " win.savestyle" - " " - "
" - "
" - " " - " _Quit" - " app.quit" - " <Primary>q" - " " - "
" - "
" - - " " - " Edit" - "
" - " " - " Undo" - " win.undo" - " " - " " - " Redo" - " win.redo" - " " - "
" - "
" - " " - " Cut" - " win.cut" - " " - " " - " Copy" - " win.copy" - " " - " " - " Paste" - " win.paste" - " " - "
" - "
" - " " - " Delete frame" - " win.deleteframe" - " " - " " - " Copy Frame" - " win.copyframe" - " " - " " - " Delete slide" - " win.deleteslide" - " " - "
" - "
" - " " - " Edit stylesheet..." - " win.stylesheet" - " " - "
" - "
" - " " - " Preferences" - " app.prefs" - " " - "
" - "
" - - " " - " Insert" - "
" - " " - " Slide" - " win.slide" - " " - " " - " Slide title" - " win.slidetitle" - " " - "
" - "
" - - " " - " Tools" - "
" - " " - " Start slideshow" - " win.startslideshow" - " " - " " - " Start slideshow here" - " win.startslideshowhere" - " " - " " - " Start slideshow without slides" - " win.startslideshownoslides" - " " - " " - " Presentation clock" - " win.clock" - " " - " " - " Test card" - " win.testcard" - " " - "
" - "
" - - " " - " Help" - "
" - " " - " About" - " app.about" - " " - "
" - "
" - "
" - - "
", -1, NULL); - + builder = gtk_builder_new_from_resource("/uk/me/bitwiz/Colloquium/menu-bar.ui"); gtk_application_set_menubar(GTK_APPLICATION(app), G_MENU_MODEL(gtk_builder_get_object(builder, "menubar"))); + g_object_unref(builder); if ( gtk_application_prefers_app_menu(GTK_APPLICATION(app)) ) { /* Set the application menu only if it will be shown by the * desktop environment. All the entries are already in the * normal menus, so don't let GTK create a fallback menu in the * menu bar. */ - GMenuModel *mmodel = G_MENU_MODEL(gtk_builder_get_object(builder, "app-menu")); printf("Using app menu\n"); + builder = gtk_builder_new_from_resource("/uk/me/bitwiz/Colloquium/app-menu.ui"); + GMenuModel *mmodel = G_MENU_MODEL(gtk_builder_get_object(builder, "app-menu")); gtk_application_set_app_menu(GTK_APPLICATION(app), mmodel); + g_object_unref(builder); } - g_object_unref(builder); configdir = g_get_user_config_dir(); app->mydir = malloc(strlen(configdir)+14); -- cgit v1.2.3