I succeeded in displaying the nimf indicator in Ubuntu MATE.
Sun, Apr 7 2024 14:23:58 KSTSeveral months ago, there was a request to create the latest Nimf package for Ubuntu 18.04 32-bit. However, I have not been able to create a package due to various reasons, and began creating a package on March 27, 2024. After trying several times, the package creation was successful on March 31st, but there was a problem in which the nimf indicator was not displayed in Ubuntu MATE. After struggling for about a week, I finally succeeded.
The problem was related to synchronous and asynchronous issues.
The sd_bus_call_method
and sd_bus_add_match
functions operate synchronously.
status = sd_bus_call_method (systray->bus,
WATCHER_INTERFACE, /* destination */
WATCHER_OBJECT_PATH, /* path */
WATCHER_INTERFACE, /* interface */
"RegisterStatusNotifierItem", /* member */
nullptr, /* ret_error*/
nullptr, /* reply */
"s", /* types */
systray->name);
if (status < 0)
{
c_log_warning ("sd_bus_call_method failed: %s", strerror (-status));
goto finally2;
}
status = sd_bus_add_match (systray->bus, &systray->signal_slot,
"type='signal',interface='org.freedesktop.DBus',"
"member='NameOwnerChanged',arg0='"WATCHER_INTERFACE"'",
cb_match, systray);
if (status < 0)
{
c_log_warning ("sd_bus_add_match failed: %s", strerror (-status));
goto finally2;
}
StatusNotifierItem(CSystray) synchronously calls RegisterStatusNotifierItem
of Ubuntu MATE’s StatusNotifierWatcher(notification-area-applet). StatusNotifierWatcher registers StatusNotifierItem. After that, StatusNotifierWatcher synchronously calls GetAll
and waits for a response. However, CSystray calls sd_bus_add_match
synchronously. So, the nimf indicator was not displayed in notification-area-applet.
I succeeded in getting the nimf indicator to show up on Ubuntu MATE by changing the source code of CSystray as follows:
status = sd_bus_call_method (systray->bus,
WATCHER_INTERFACE, /* destination */
WATCHER_OBJECT_PATH, /* path */
WATCHER_INTERFACE, /* interface */
"RegisterStatusNotifierItem", /* member */
nullptr, /* ret_error*/
nullptr, /* reply */
"s", /* types */
systray->name);
if (status < 0)
c_log_warning ("sd_bus_call_method failed: %s", strerror (-status));
status = sd_bus_add_match_async (systray->bus, &systray->signal_slot,
"type='signal',interface='org.freedesktop.DBus',"
"member='NameOwnerChanged',arg0='"WATCHER_INTERFACE"'",
cb_match, nullptr, systray);
if (status < 0)
{
c_log_warning ("sd_bus_add_match_async failed: %s", strerror (-status));
c_systray_free (systray);
return nullptr;
}
In addition, several other parts have been changed. After reviewing the source code further, I plan to publish the package for Ubuntu MATE 18.04 32-bit, probably within this month.