Skip to content

Commit e3da945

Browse files
committed
Update GTK application menu handling on Linux
Replaces G_APPLICATION_FLAGS_NONE with G_APPLICATION_DEFAULT_FLAGS when creating the GTK application. Removes unsupported call to gtk_application_set_app_menu with legacy GtkMenu widgets and updates comments to clarify that application menus are not supported with legacy menus in GTK3. Returns false to indicate unsupported operation and adds a TODO for future GMenuModel implementation.
1 parent 312c351 commit e3da945

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/platform/linux/application_linux.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Application::Impl {
2525

2626
// Create GTK application with default ID
2727
gtk_app_ = gtk_application_new("com.nativeapi.application",
28-
G_APPLICATION_FLAGS_NONE);
28+
G_APPLICATION_DEFAULT_FLAGS);
2929

3030
if (!gtk_app_) {
3131
return false;
@@ -105,10 +105,13 @@ class Application::Impl {
105105
return false;
106106
}
107107

108-
// Set the application menu
109-
gtk_application_set_app_menu(gtk_app_, GTK_MENU_MODEL(gtk_menu));
110-
111-
return true;
108+
// Note: gtk_application_set_app_menu expects GMenuModel, but our Menu
109+
// class uses legacy GtkMenu widgets. Setting application menu bar is not
110+
// supported with legacy menus in GTK3. Users should add menu bars directly
111+
// to their windows instead.
112+
// TODO: Consider implementing GMenuModel-based menus in the future.
113+
114+
return false; // Not supported with legacy GtkMenu
112115
}
113116

114117
void CleanupEventMonitoring() {

0 commit comments

Comments
 (0)