[balsa/wip/gtk4: 26/351] Make main window's menubar visible
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gtk4: 26/351] Make main window's menubar visible
- Date: Wed, 23 May 2018 21:19:07 +0000 (UTC)
commit 87d7dfc2a7b41f26c6b1103a8cbc066d09862dd0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat Oct 7 12:23:26 2017 -0400
Make main window's menubar visible
src/main-window.c | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/src/main-window.c b/src/main-window.c
index 2d54942..e43ec24 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -1932,9 +1932,6 @@ bw_add_app_action_entries(GActionMap * action_map, gpointer user_data)
G_N_ELEMENTS(app_entries), user_data);
}
-static void
-bw_add_win_action_entries(GActionMap * action_map)
-{
static GActionEntry win_entries[] = {
{"new-message", new_message_activated},
{"continue", continue_activated},
@@ -2030,6 +2027,9 @@ bw_add_win_action_entries(GActionMap * action_map)
show_preview_pane_change_state},
};
+static void
+bw_add_win_action_entries(GActionMap * action_map)
+{
g_action_map_add_action_entries(action_map, win_entries,
G_N_ELEMENTS(win_entries), action_map);
}
@@ -2055,12 +2055,33 @@ bw_set_menus(BalsaWindow * window)
ui_file = g_build_filename(BALSA_DATA_PREFIX, "ui", "main-window.ui",
NULL);
if (gtk_builder_add_from_file(builder, ui_file, &err)) {
+#ifndef SET_MENUBAR_SETS_A_VISIBLE_MENUBAR
+ GtkWidget *menubar;
+#endif /* SET_MENUBAR_SETS_A_VISIBLE_MENUBAR */
gtk_application_set_app_menu(balsa_app.application,
G_MENU_MODEL(gtk_builder_get_object
(builder, "app-menu")));
+#ifdef SET_MENUBAR_SETS_A_VISIBLE_MENUBAR
gtk_application_set_menubar(balsa_app.application,
G_MENU_MODEL(gtk_builder_get_object
(builder, "menubar")));
+#else /* SET_MENUBAR_SETS_A_VISIBLE_MENUBAR */
+ menubar = libbalsa_window_get_menu_bar(GTK_APPLICATION_WINDOW(window),
+ win_entries,
+ G_N_ELEMENTS(win_entries),
+ ui_file, &err, window);
+ if (err) {
+ g_print("%s %s\n", __func__, err->message);
+ g_error_free(err);
+ } else {
+#if HAVE_MACOSX_DESKTOP
+ libbalsa_macosx_menu(window, GTK_MENU_SHELL(menubar));
+#else
+ gtk_box_pack_start(GTK_BOX(window->vbox), menubar);
+#endif
+ }
+#endif /* SET_MENUBAR_SETS_A_VISIBLE_MENUBAR */
+
} else {
g_print("%s error: %s\n", __func__, err->message);
balsa_information(LIBBALSA_INFORMATION_WARNING,
@@ -2068,6 +2089,7 @@ bw_set_menus(BalsaWindow * window)
err->message);
g_error_free(err);
}
+
g_free(ui_file);
g_object_unref(builder);
}
@@ -2199,7 +2221,6 @@ balsa_window_new()
NULL);
/* Set up the GMenu structures */
- bw_set_menus(window);
/* Set up <alt>n key bindings */
bw_set_alt_bindings(window);
@@ -2208,6 +2229,8 @@ balsa_window_new()
gtk_widget_show(window->vbox);
gtk_container_add(GTK_CONTAINER(window), window->vbox);
+ bw_set_menus(window);
+
gtk_window_set_title(GTK_WINDOW(window), "Balsa");
balsa_register_pixbufs(GTK_WIDGET(window));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]