如何在 GTK# 中使用 Ubuntu Unity 全局菜单?

发布于 2024-12-18 04:12:05 字数 257 浏览 4 评论 0原文

我正在开发一个简单的 GTK# 应用程序(没什么大不了的,只是一个小项目),我注意到我的应用程序菜单栏显示在我的应用程序窗口中,而不是 Ubuntu 的 Unity 全局菜单栏。

有没有办法让菜单栏显示在unity菜单栏中?我尝试用谷歌搜索一下,但大多数结果似乎都是关于禁用此行为 - 我想启用它。

目前,我正在通过 MonoDevelop 的可视化编辑器将菜单栏添加到 VBox。

I'm developing a simple GTK# application(nothing serious, just a little project), and I've noticed my application menu bar is showing in my application window instead of Ubuntu's Unity global menu bar.

Is there any way to make the menu bar show up in the unity menu bar? I've tried to google a bit but most results seem to be about disabling this behavior - I want to enable it.

Currently, I'm adding the menu bar to a VBox, via MonoDevelop's visual editor.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哽咽笑 2024-12-25 04:12:05

不知何故,该应用程序无需任何更改即可正常运行。

我的菜单栏位于 vbox 中,它是我创建的主窗口的唯一子窗口。
它是 vbox 的第一个元素,不确定是否会影响任何内容。

这是我注意到的:

我问这个问题是因为当我在 MonoDevelop 上单击“运行”时,菜单栏显示在窗口中而不是全局的。

但是,当我直接从命令行 mono [myappname].exe 运行它时,它工作得很好。不知道这里发生了什么。

显然,Unity 开发人员让自动使用全局菜单栏变得很容易,但不知何故,MonoDevelop 做了一些事情,当应用程序从 MD 运行时禁用了此行为。
不确定这是否是 MD 的错误、预期行为或者这里是否存在一些问题。

由于该应用程序仅出于测试目的从 MD 运行,因此我接受它现在的样子。

Somehow, the application works fine without any changes.

My menubar is in a vbox which is the only child of the main window I created.
It is the first element of the vbox, not sure if that affects anything.

And here's what I noticed:

I asked this question because when I clicked "Run" on MonoDevelop, the menu bar showed up in the window instead of being global.

However, when I run it directly from the command-line mono [myappname].exe, it works just fine. Not sure what's going on here.

So apparently the Unity devs made it easy to use the global menu bar automatically, but somehow MonoDevelop does something that disables this behavior when the app is run from MD.
Not sure if it is a bug of MD, expected behavior or if there's some gotcha going on here.

Since the application is only run from MD for testing purposes, I'm accepting it the way it is now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文