cGmail should support the new Ubuntu notification system

Bug #335197 reported by Tom Vetterlein on 2009-02-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Francesco Marella
cgmail (Ubuntu)
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:

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

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

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.

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.

tags: added: dxteam

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.

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

Bram Bonné (brambonne) wrote :

A better fix would be to edit /usr/share/cgmail/service/ 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.

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.

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

Bram Bonné (brambonne) wrote :

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

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.

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:
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.

Bram Bonné (brambonne) wrote :

I edited 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")]

Bram Bonné (brambonne) wrote :

Apparently launchpad doesn't like my indentation. Here is a link to the pastebin version:

Tom Vetterlein (smbm) wrote :

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

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:

Bram Bonné (brambonne) wrote :

Attached is a fixed version of the latest 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 with the attached version (be sure to back up your old one, though) and test if it works.

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/", line 43, in on_status_changed
    msec = 10000)
  File "/usr/lib/python2.6/dist-packages/cGmail/lib/", line 146, in notify
    if buttons and actionsSupport:
NameError: global name 'buttons' is not defined

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/",
> line 43, in on_status_changed
> msec = 10000)
> File "/usr/lib/python2.6/dist-packages/cGmail/lib/", line 146,
> in notify
> if buttons and actionsSupport:
> NameError: global name 'buttons' is not defined
> --
> cGmail should support the new Ubuntu notification system
> You received this bug notification because you are a direct subscriber
> of the bug.

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.

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.

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
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.

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

Ernst (ernst-blaauw) wrote :

As you requested, I've opened a new bug report:

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  Edit
Everyone can see this information.

Other bug subscribers