GLib.Notification 和 Gnome-shell [英] GLib.Notification and Gnome-shell

查看:60
本文介绍了GLib.Notification 和 Gnome-shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Synapse 项目中使用 GLib.Notification apihttps://code.launchpad.net/~jeremy-munsch/synapse-project/fix-notification/+merge/273323

I'm trying to make use of the GLib.Notification api in Synapse project https://code.launchpad.net/~jeremy-munsch/synapse-project/fix-notification/+merge/273323

它正在一些 DE 上工作,除了 gnome-shell.

It is working on some DE, except gnome-shell.

我的实现基本上是这样的:

My implementation is basically this :

var notification = new GLib.Notification (_("Synapse - Pastebin"));
notification.set_body (msg);
var gicon = GLib.Icon.new_for_string ("synapse");
notification.set_icon (gicon);
GLib.Application.get_default ().send_notification (null, notification);

我看到了一些其他相关信息https://bugzilla.gnome.org/show_bug.cgi?id=710913https://wiki.gnome.org/HowDoI/GNotification

I saw some other related info https://bugzilla.gnome.org/show_bug.cgi?id=710913 https://wiki.gnome.org/HowDoI/GNotification

最后一个链接:

警告:gnome-shell 使用桌面文件来查找有关通知发送者的额外信息(应用程序图标、名称).如果您没有基本名称与应用程序 ID 匹配的桌面文件,则您的通知将不会显示.

Warning: gnome-shell uses desktop files to find extra information (app icon, name) about the sender of the notification. If you don't have a desktop file whose base name matches the application id, then your notification will not show up.

我真的不明白这具体意味着/暗示什么.应用名称是 org.gnome.Synapse.desktop 文件包含:

I don't really understand what exactly this concretely means/implies. The app name is org.gnome.Synapse The .desktopfile contains :

data/synapse.desktop.inhttp://paste.ubuntu.com/13287809/

数据/synapse.desktophttp://paste.ubuntu.com/13287846/

那么使用 GLib.Notification 的先决条件究竟是什么?(Bonus) 两个带有 .in 的桌面文件有什么区别?

So what exactly are the prerequisites to make use of GLib.Notification ? (Bonus) what is the difference between the two desktop files with .in ?

推荐答案

您的 .desktop 文件需要命名为 org.gnome.synapse.desktop 并且需要先安装它以便 Gnome 找到它,通常在/usr/local/share/applications/appname 如果您使用具有 root 权限的 make install 从源代码安装它.

Your .desktop file needs to be named org.gnome.synapse.desktop and it will need to be installed first in order for Gnome to find it, usually in /usr/local/share/applications/appname if you install it from source using make install with root privileges.

正如 Jens 在他的评论中所观察到的,.in 文件是 Makefile 模板,在这种情况下,Make 使用 gettext 处理 desktop.in 文件以对其进行本地化..in 文件中以 _ 为前缀的键被解析为来自源树的 po 目录的可用翻译,其结果您可以在 .desktop 文件中看到.仅实际安装生成的 .desktop 文件.

As Jens observed in his comment, .in files are Makefile templates, in this case, Make processes the desktop.in file using gettext to localize it. The keys in the .in file that are prefixed with _ are parsed into the available translations from the source tree's po directory, the result of which you see in the .desktop file. Only the resulting .desktop file is actually installed.

我希望这会有所帮助.

这篇关于GLib.Notification 和 Gnome-shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆