After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 788237 - Inevitable assert from a call of g_application_send_notification()
Inevitable assert from a call of g_application_send_notification()
Status: RESOLVED DUPLICATE of bug 776583
Product: glib
Classification: Platform
Component: gapplication
unspecified
Other Windows
: Normal critical
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-09-27 13:18 UTC by pspgen
Modified: 2017-10-26 09:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
code that reproduces the bug (60.14 KB, image/png)
2017-09-27 13:18 UTC, pspgen
Details

Description pspgen 2017-09-27 13:18:59 UTC
Created attachment 360531 [details]
code that reproduces the bug

g_application_send_notification() causes assert

GLib-GObject-CRITICAL **: g_object_new:
assertion 'G_TYPE_IS_OBJECT (object_type)' failed

I tested with every possible known-to-work code excerpt including the original library extension "gnotification" by Lars Uebernickel itself and they all end up the same way. Even tough, I provided attachment - an example code to demonstrate the essence of the problem.
Comment 1 LRN 2017-09-27 14:03:38 UTC
Um...last time i checked, there were no notification backends that worked on W32. I really wanted to implement one, but the API (W32 toast notifications) that i needed is COM-only, and MinGW-w64 doesn't have the necessary headers for it.
Comment 2 pspgen 2017-09-27 14:34:45 UTC
(In reply to LRN from comment #1)
> Um...last time i checked, there were no notification backends that worked on
> W32. I really wanted to implement one, but the API (W32 toast notifications)
> that i needed is COM-only, and MinGW-w64 doesn't have the necessary headers
> for it.

I really like GTK+ and I want to finish my projects with GTK+ only.
I didn't saw any notes on that where it works and where it doesn't, so I just let you know. I had no clue what is the case.
(Also toast notifications AFAIK are implemented in Windows 8.1 and above, not windows 7?)

So this leads to the conclusion I have to use winapi implementations of simple popup notification balloons or use Delphi or Object Pascal as it provides its TNotificationCenter component. Awh, I feared this will happen.

Another solution is someone introducing me to GTK+ coding specifically this section so that I can write the required prerequisites or come up with a different approach regarding Win32 with the standard headers provided in the toolkit.
Comment 3 LRN 2017-09-27 15:01:21 UTC
Well, i briefly looked at the GNotificationBackend interface, and it's very simple...It should be easy enough to put together some kind of implementation for it.

Now, we could just do it in GTK...OR we could do it the right way (TM) and implement a D-Bus server for it. The good thing about a notification server is that notifications can persist even after an application is terminated. Also, GTK already has backends for talking to a notification server, so we'd only need to enable these backends on W32 (at a glance, the code doesn't use anything that doesn't work on W32 already). Also, that way the server would transparently use Shell_NotifyIcon (on Windows 7 and earlier) or toast notificaions (on Windows 8 and later; if we ever get an opportunity to implement these).
Comment 4 pspgen 2017-09-27 15:28:19 UTC
(In reply to LRN from comment #3)
> Well, i briefly looked at the GNotificationBackend interface, and it's very
> simple...It should be easy enough to put together some kind of
> implementation for it.
> 
> Now, we could just do it in GTK...OR we could do it the right way (TM) and
> implement a D-Bus server for it. The good thing about a notification server
> is that notifications can persist even after an application is terminated.
> Also, GTK already has backends for talking to a notification server, so we'd
> only need to enable these backends on W32 (at a glance, the code doesn't use
> anything that doesn't work on W32 already). Also, that way the server would
> transparently use Shell_NotifyIcon (on Windows 7 and earlier) or toast
> notificaions (on Windows 8 and later; if we ever get an opportunity to
> implement these).

As a licensed programmer with specialty software, I can freely write C code whether it involves system programming or graphical programming with GTK+. Now I can create implementation of Shell_NotifyIcon, of course, but I don't know how to create D-Bus. I better not learn how to and make official or unofficial releases out of it.

I also checked gio source code gnotification and gnotificationbackend, it looks simple, but not sure where to start from. Don't want to loose MUCH extra time (analyzing, writing, testing, debugging), it is a risk I would do that. If there is any way I can help, I will.
If sadly no one plans adding support for such an important thing, I will just use Shell_NotifyIcon if windows detected and GNotification otherwise.
Comment 5 Matthias Clasen 2017-10-26 05:08:24 UTC
if you want my opinion: the right way is to implement this by using the platform apis, *not* implementing a dbus server
Comment 6 Matthias Clasen 2017-10-26 05:09:13 UTC
but this bug belongs to glib
Comment 7 Philip Withnall 2017-10-26 09:06:29 UTC
Duplicate of bug #776583.

*** This bug has been marked as a duplicate of bug 776583 ***