diff --git a/demos/gtk-demo/application.c b/demos/gtk-demo/application.c index 64cf105a4e..cef94fca28 100644 --- a/demos/gtk-demo/application.c +++ b/demos/gtk-demo/application.c @@ -328,19 +328,14 @@ static void startup (GApplication *app) { GtkBuilder *builder; - GMenuModel *appmenu; - GMenuModel *menubar; G_APPLICATION_CLASS (demo_application_parent_class)->startup (app); builder = gtk_builder_new (); gtk_builder_add_from_resource (builder, "/application_demo/menus.ui", NULL); - appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu"); - menubar = (GMenuModel *)gtk_builder_get_object (builder, "menubar"); - - gtk_application_set_app_menu (GTK_APPLICATION (app), appmenu); - gtk_application_set_menubar (GTK_APPLICATION (app), menubar); + gtk_application_set_menubar (GTK_APPLICATION (app), + G_MENU_MODEL (gtk_builder_get_object (builder, "menubar"))); g_object_unref (builder); } @@ -353,6 +348,7 @@ create_window (GApplication *app, window = (DemoApplicationWindow *)g_object_new (demo_application_window_get_type (), "application", app, + "show-menubar", TRUE, NULL); if (content) gtk_text_buffer_set_text (window->buffer, content, -1); diff --git a/demos/gtk-demo/appmenu.ui b/demos/gtk-demo/appmenu.ui deleted file mode 100644 index 4b65b186e4..0000000000 --- a/demos/gtk-demo/appmenu.ui +++ /dev/null @@ -1,18 +0,0 @@ - - - -
- - About - app.about - -
-
- - _Quit - app.quit - <Control>q - -
-
-
diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml index 19a2f8a168..0563e27116 100644 --- a/demos/gtk-demo/demo.gresource.xml +++ b/demos/gtk-demo/demo.gresource.xml @@ -2,7 +2,6 @@ main.ui - appmenu.ui application.c diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index f8ef62d915..653e7a2f4a 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -972,23 +972,6 @@ populate_model (GtkTreeModel *model) } -static void -startup (GApplication *app) -{ - GtkBuilder *builder; - GMenuModel *appmenu; - const char *ids[] = { "appmenu", NULL }; - - builder = gtk_builder_new (); - gtk_builder_add_objects_from_resource (builder, "/ui/appmenu.ui", ids, NULL); - - appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu"); - - gtk_application_set_app_menu (GTK_APPLICATION (app), appmenu); - - g_object_unref (builder); -} - static void row_activated_cb (GtkWidget *tree_view, GtkTreePath *path, @@ -1219,7 +1202,6 @@ main (int argc, char **argv) g_application_add_main_option (G_APPLICATION (app), "list", 0, 0, G_OPTION_ARG_NONE, "List examples", NULL); g_application_add_main_option (G_APPLICATION (app), "autoquit", 0, 0, G_OPTION_ARG_NONE, "Quit after a delay", NULL); - g_signal_connect (app, "startup", G_CALLBACK (startup), NULL); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); g_signal_connect (app, "command-line", G_CALLBACK (command_line), NULL); g_signal_connect (app, "handle-local-options", G_CALLBACK (local_options), NULL); diff --git a/demos/gtk-demo/menus.ui b/demos/gtk-demo/menus.ui index 0fe4bd946a..f67180b9b4 100644 --- a/demos/gtk-demo/menus.ui +++ b/demos/gtk-demo/menus.ui @@ -1,38 +1,39 @@ - -
- - _New - app.new - <Control>n - - - _Open - app.open - - - _Save - app.save - <Control>s - - - Save _As... - app.save-as - <Control>s - -
-
- - _Quit - app.quit - <Control>q - -
-
- _Preferences + _Application +
+ + _New + app.new + <Control>n + + + _Open + app.open + + + _Save + app.save + <Control>s + + + Save _As... + app.save-as + <Control>s + +
+
+ + _Quit + app.quit + <Control>q + +
+
+ + _File
_Prefer Dark Theme