Page MenuHomeSolus

Software Center Notification action fails
Closed, ResolvedPublic

Description

Solus promptly pops up a notification every time new software updates are available. This is a great future, but the "Open Software Center" button inside the notification doesn't work, no matter how many times I click on it, so I have to open the Software Center manually.

Event Timeline

JoshStrobl added a project: Software.
JoshStrobl moved this task from Backlog to System and Configuration Fixes on the Software board.

I have also noticed when I open Software Centre and manually check for updates and some are available, a notification is shown even though the updates list is visible.

While that may be a minor irritations, it's not a bug. The update checker is a separate process, which is independent of the Software Center.

Software Centre not updating when clicking the button "Open Software Centre" button in the pop-up is surely a bug though :) It's the same on my machine, clicking the button does nothing.

@DataDrake : From a usability point of view it is a bug: if there is a button "Open Software Center" in the notification, it should open it. Also from a technical point of view, I don't understand it either: even if the update checker and the software center are independent processes, in all cases the button should open the Software center just like when the user clicks on the Software center icon (regardless if there are updates or not).

ikey added a subscriber: ikey.

@DataDrake huh? Obviously it is a bug. Behaviour doesn't do as advertised = broken

Apologies. I was responding to @mate-user 's comment about the notification firing off even though SC was open.

@ikey Could you fix this one before the snapshot?

ikey renamed this task from Small Solus notification bug to Software Center Notification action fails.Mar 28 2017, 4:10 PM
ikey raised the priority of this task from Normal to Unbreak Now!.
ikey added a project: Snapshots (Snapshot 2).
Unknown Object (User) added a subscriber: Unknown Object (User).EditedMar 28 2017, 8:21 PM

Actually, there isn't a mainloop, neither Gtk nor GLib.

For a notification to actually "fire" callbacks, you'll need a mainloop. Could be solved by adding

GLib.MainLoop().run()

after 314

self.notification.show()

Not sure if that's the "ikey" way to solve it, but it works ;-).

Does this break the GApplication integration? like will it still quit when told, retain single instance, etc.

Unknown Object (User) added a comment.EditedMar 28 2017, 8:41 PM


quick&dirty example on mainloop + mainloop quit (should give you a better idea)
Yes, it retains single instance etc, does not break GApplication integration to my knowledge.

You'll want to get the MainLoop() into a variable though, and you'll want to quit it to avoid "hanging" in the background ;-). It will block until the Popen is through though (not when SC quits, but when the command was actually fired by Popen).

(time import is unnecessary, was for quick&dirty testing)

Unknown Object (User) added a comment.Mar 28 2017, 9:06 PM
This comment was removed by Unknown Object (User).
Unknown Object (User) added a comment.EditedMar 28 2017, 9:52 PM

On a 2nd thought, we need a timeout callback because otherwise if the user does not click, we'll run into the issue that we're blocking solus_update.

<removed> test+patch

[edit] I can not test if it actually would close GApplication main loop, even if I don't think so, I'll need a package update to know for sure :D. I didn't find a way to simulate that though.

Unknown Object (User) added a comment.EditedMar 31 2017, 11:19 AM

Thanks to the update in the repos, I could do a real world test, and it showed that there's just a one-line issue:

~/solus/solus-sc $ ./solus-update-checker
TypeError: action_show_updates() takes exactly 4 arguments (3 given)

The issue:

self.notification.add_action("open-sc", _("Open Software Center"),
                                     self.action_show_updates)

The solution:

self.notification.add_action("open-sc", _("Open Software Center"),
                                     self.action_show_updates, None)