From: Matthias Clasen Date: Fri, 22 May 2020 20:36:20 +0000 (-0400) Subject: examples: Stop using appmenu apis X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~16^2~123^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6c31092c69c3dd379c73d8351ccc82e7de1fa4fb;p=gtk4.git examples: Stop using appmenu apis The appmenu-related GtkApplication apis are going away. --- diff --git a/examples/plugman.c b/examples/plugman.c index 0e0882fcb5..9e9c683242 100644 --- a/examples/plugman.c +++ b/examples/plugman.c @@ -4,12 +4,12 @@ static const char *red_css = -"textview>text {" +"textview {" " color: red;" "}"; static const char *black_css = -"textview>text {" +"textview {" " color: black;" "}"; @@ -81,6 +81,7 @@ new_window (GApplication *app, gtk_window_set_default_size ((GtkWindow*)window, 640, 480); g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window); gtk_window_set_title (GTK_WINDOW (window), "Plugman"); + gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), TRUE); grid = gtk_grid_new (); gtk_window_set_child (GTK_WINDOW (window), grid); @@ -334,9 +335,10 @@ configure_plugins (GSimpleAction *action, "" " " " Plugins" - " " + " " " " " True" + " vertical" " " " " " Red Plugin - turn your text red" @@ -352,7 +354,7 @@ configure_plugins (GSimpleAction *action, " " " " " " - " " + " " " True" " " " " @@ -409,23 +411,24 @@ plug_man_startup (GApplication *application) builder = gtk_builder_new (); gtk_builder_add_from_string (builder, "" - " " - "
" - " " - " _About Plugman" - " app.about" - " " - "
" - "
" - " " - " _Quit" - " app.quit" - " <Primary>q" - " " - "
" - "
" " " " " + " _Plugman" + "
" + " " + " _About Plugman" + " app.about" + " " + "
" + "
" + " " + " _Quit" + " app.quit" + " <Primary>q" + " " + "
" + "
" + " " " _Edit" "
" " " @@ -457,7 +460,6 @@ plug_man_startup (GApplication *application) " " "
" "
", -1, NULL); - gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"))); gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar"))); g_object_set_data_full (G_OBJECT (application), "plugin-menu", gtk_builder_get_object (builder, "plugins"), g_object_unref); g_object_unref (builder); diff --git a/examples/sunny.c b/examples/sunny.c index 1bb3284eeb..43757023a0 100644 --- a/examples/sunny.c +++ b/examples/sunny.c @@ -9,7 +9,7 @@ new_window (GApplication *app, GtkWidget *header; window = gtk_application_window_new (GTK_APPLICATION (app)); - gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), FALSE); + gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), TRUE); gtk_window_set_default_size ((GtkWindow*)window, 640, 480); gtk_window_set_title (GTK_WINDOW (window), "Sunny"); gtk_window_set_icon_name (GTK_WINDOW (window), "sunny"); @@ -138,25 +138,28 @@ startup (GApplication *application) builder = gtk_builder_new (); gtk_builder_add_from_string (builder, "" - " " - "
" - " " - " _New Window" - " app.new" - " " - " " - " _About Sunny" - " app.about" - " " - " " - " _Quit" - " app.quit" - " <Primary>q" - " " - "
" + " " + " " + " Sunny" + "
" + " " + " _New Window" + " app.new" + " " + " " + " _About Sunny" + " app.about" + " " + " " + " _Quit" + " app.quit" + " <Primary>q" + " " + "
" + "
" "
" "", -1, NULL); - gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"))); + gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar"))); g_object_unref (builder); }