cGmail should support the new Ubuntu notification system

Bug #335197 reported by Tom Vetterlein
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cGmail
Fix Released
Low
Francesco Marella
cgmail (Ubuntu)
Fix Released
Wishlist
Francesco Marella

Bug Description

As the title says.

As it's in Python I've edited my installed version to be compliant by commenting out a couple of lines.

I've created a branch where I've attempted to replicate the changes:

http://bazaar.launchpad.net/~t.vetterlein/cgmail/no_dialog_buttons/revision/19

It's a bit of a dirty hack but seems to work here.

I've no idea how to package it or anything so I'm hoping for some help here.

Changed in cgmail:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Ketil Wendelbo Aanensen (ketilwaa-deactivatedaccount) wrote :

Please, please fix this. Cgmail on Jaunty is not very pretty with a window that I need to click to make go away.

Revision history for this message
Tom Vetterlein (smbm) wrote :

Are you running 32 or 64bit? If you're running 64bit I can send you a new package that should work fine.

If you're on 32bit I can tell you how to roll your own.

Sadly I haven't managed to get my PPA working at all otherwise it's be a lot easier to get to people.

Revision history for this message
Tom Vetterlein (smbm) wrote :

Although, thinking about it. The package I've built on my 64bit install should work on 32bit as it's all in Python. Not completely certain on that though. You're welcome to try it, I'll try and host it somewhere.

Revision history for this message
Tom Vetterlein (smbm) wrote :
tags: added: dxteam
Revision history for this message
Ketil Wendelbo Aanensen (ketilwaa-deactivatedaccount) wrote :

Thanks, this works fine on 32 bit too. Although my account settings were mysteriously hosed, and I needed to set it up again. The notifications look great.

Revision history for this message
Ketil Wendelbo Aanensen (ketilwaa-deactivatedaccount) wrote :

I've had some problems with your deb the last hour or two. The service has crashed 2-3 times, when checking for mail.

Revision history for this message
Bram Bonné (brambonne) wrote :

A better fix would be to edit /usr/share/cgmail/service/notifier.py and on line 122 not only check for 'buttons', but also check if the notification system supports buttons.
Temp fix is: comment out lines 122-125 and unindent line 126.

Revision history for this message
Ketil Wendelbo Aanensen (ketilwaa-deactivatedaccount) wrote :

After the last update to notify-osd, messages from cgmail (T. Vetterlein package) are shown on yellow background in the lower right corner. Buttons are not present. See screenshot.

Revision history for this message
Ketil Wendelbo Aanensen (ketilwaa-deactivatedaccount) wrote :

Using the deb in Vetterlein PPA (0.5.1-0ubuntu1), notifications are shown like they should again

Revision history for this message
Bram Bonné (brambonne) wrote :

Using my fix should also still work with the update to notify-osd.

Revision history for this message
Tom Vetterlein (smbm) wrote :

Wow, what a lot of activity.

Sorry everyone, was out all day yesterday, working today.

@ Ketil:

Glad you managed to get it working using the PPA version. I meant to post a link up to that but hadn't got around to it yet.

@ Bram:

I have emailed you to get more details, if there's a way to make this less hackish it should probably be done.

Revision history for this message
Bram Bonné (brambonne) wrote :

Next is the e-mail I sent to Tom Vetterlein, which contains some additional info regarding the bug:

You can find more info on the freedesktop notification specification, more specific in the following paragraph: http://www.galago-project.org/specs/notification/0.9/x408.html#command-get-capabilities
It seems that it's possible to call the GetCapabilities() method using DBus. Since it already sends the notification via DBus, this shouldn't be too hard.
GetCapabilities() will then return if 'actions' are supported. If this is the case, it is safe to include the buttons. Otherwise, they should be avoided. This can be done in the if-test I described in my previous comment.

Revision history for this message
Bram Bonné (brambonne) wrote :

I edited notifier.py here to do just that, but I've only been able to test it on systems with the new notification system (so I don't guarantuee that it will work on systems that DO support actions, although it should).
I wasn't able to find the original file to create a patch, so here is the code that should be inserted instead of

> if buttons:
> actions = ["openbrowser", _("Go to Gmail Account"),\
> "mailreader", _("Open mail reader")]

this is the replacement:

> # Check if the notification system supports actions
> capabilitiesMethod = self.notif.get_dbus_method("GetCapabilities")
> capabilities = capabilitiesMethod()
> actionsSupport = "actions" in capabilities
>
> if buttons and actionsSupport:
> actions = ["openbrowser", _("Go to Gmail Account"),\
> "mailreader", _("Open mail reader")]

Revision history for this message
Bram Bonné (brambonne) wrote :

Apparently launchpad doesn't like my indentation. Here is a link to the pastebin version:
http://paste.ubuntu.com/140956/

Revision history for this message
Tom Vetterlein (smbm) wrote :

Thanks for the help Bram, I don't have these lines in my notifier.py though, which version of cGmail are you running?

Revision history for this message
Bram Bonné (brambonne) wrote :

I'm running version 0.4. And, as I just noticed, this is apparently not the latest version available. It IS the version currently in the Ubuntu repository, though.
It seems that, in the new version, the patch can be applied by replacing lines 147-156 with: http://paste.ubuntu.com/140983/

Revision history for this message
Bram Bonné (brambonne) wrote :

Attached is a fixed version of the latest notify.py. Since I haven't got the latest package installed, I haven't been able to check if this works, although it should (it's basically the same modification as the one I made in the older package). So maybe someone can replace his notify.py with the attached version (be sure to back up your old one, though) and test if it works.

Revision history for this message
Tom Vetterlein (smbm) wrote :

I tried it but it results in:

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/cGmail/service/statusnotifier.py", line 43, in on_status_changed
    msec = 10000)
  File "/usr/lib/python2.6/dist-packages/cGmail/lib/notifier.py", line 146, in notify
    if buttons and actionsSupport:
NameError: global name 'buttons' is not defined

Revision history for this message
Bram Bonné (brambonne) wrote : Re: [Bug 335197] Re: cGmail should support the new Ubuntu notification system

Oh right that was still from the old version, fixed version will be uploaded
to launchpad in a minute.

On Mon, Mar 30, 2009 at 11:49 PM, Tom Vetterlein <email address hidden>wrote:

> I tried it but it results in:
>
> Traceback (most recent call last):
> File "/usr/lib/python2.6/dist-packages/cGmail/service/statusnotifier.py",
> line 43, in on_status_changed
> msec = 10000)
> File "/usr/lib/python2.6/dist-packages/cGmail/lib/notifier.py", line 146,
> in notify
> if buttons and actionsSupport:
> NameError: global name 'buttons' is not defined
>
> --
> cGmail should support the new Ubuntu notification system
> https://bugs.launchpad.net/bugs/335197
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Bram Bonné (brambonne) wrote :

Oops, that was still from the old API. The check for 'buttons' can safely be removed (keep actionsSupport though). I also forgot to add something else. Fixed version is attached. I'm sorry for not being able to test myself, by the way.

Revision history for this message
Tom Vetterlein (smbm) wrote :

That's spot on. Works a treat, I'll upload the changes to my branch and turn it into a package and things.

No worries for not being able to test. I'm sorry I can't code.

Revision history for this message
Tom Vetterlein (smbm) wrote :

It built fine, I am running the new version, it is in my PPA for all comers.

Thanks again Bram.

Changed in cgmail (Ubuntu):
assignee: nobody → Francesco Marella (francesco-marella)
status: Confirmed → Fix Committed
Changed in cgmail (Ubuntu):
status: Fix Committed → Confirmed
Changed in cgmail:
status: New → Fix Committed
Changed in cgmail:
assignee: nobody → Francesco Marella (francesco-marella)
importance: Undecided → Low
milestone: none → 0.6.0
Changed in cgmail (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Ernst (ernst-blaauw) wrote :

Is it possible for cGmail to also support the indicator-applet (or Messaging Menu)? I think that's also part of the new notification system.

Revision history for this message
Francesco Marella (francesco-marella) wrote :

Ernst, please open a new bug report.
This feature will be included in cGmail 0.7 series.

Revision history for this message
Ernst (ernst-blaauw) wrote :

As you requested, I've opened a new bug report:
https://bugs.launchpad.net/ubuntu/+source/cgmail/+bug/184888

Revision history for this message
Ernst (ernst-blaauw) wrote :
Changed in cgmail:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.