UnityMailWebMailNotification

Unity Mail: Webmail Notification on Your Desktop - Instructors: mitya57

So, let's start 
I'm Dmitry Shachnev, currently student at Moscow University 
I am developer of Unity Mail, 
ReText (retext.sf.net), 
TQ Educational suite (tq-suite.sf.net) and some other things 
Since my first distro was Mandriva, I'm also known as Mandriver 
Unity Mail is an application that displays unread messages count on your Launcher, 
as well as Notify-OSD notifications 
and mail subjects in Messaging Menu (this is currently only for Oneiric) 
It works with any IMAP4 or IMAP4-SSL server, not only with GMail as some people think 
It also support multiple accounts 
*supports 
It's written in Python and uses GObject-Introspection, 
I'll say more about this later 
Three days ago I released the new version, 0.8 
(the Natty backport will come soon, too) 
It has Messaging Menu integration and new configuration dialog 
Screenshot: http://ubuntuone.com/4VNpTopZZxmGN2fyXY4ZmD 
It's also the first release working on Oneiric 
So, now about used technologies 
GObject-Introspection (http://live.gnome.org/GObjectIntrospection) is a new GNOME framework 
for accessing C-language API in many languages, 
such as Python, Vala, and so on 
In Ubuntu, Python bindings are provided by python-gobject package 
The most known component is Gtk API, 
which allows working with both Gtk2 and Gtk3 
It's recommended alternative for PyGtk, 
read more about porting here: http://live.gnome.org/PyGObject/IntrospectionPorting 
But there are many other bindings, 
You can use any API provided by gir1.2-* packages 
Here is Unity Mail's import string: 
from gi.repository import GObject, GLib, Gtk, Unity, Notify, Indicate 
The last three are Ubuntu-specific technologies, so let's speak more 
about them 

Unity Launcher API provides a way to set a count badge or a progress-bar 
for a specific .desktop file 
https://wiki.ubuntu.com/Unity/LauncherAPI 
This page contains an overview and code examples for Python and Vala

Indicate API 
It provides a way to add an indicator to your panel, or integrate 
with existing menu (Messaging Menu in my case) 
I used this page as a documentation: 
http://www.kryogenix.org/days/2011/01/16/working-with-the-ubuntu-messaging-menu 
Note that UM doesn't make that envelope blue or green, it just add some items 
If you want to add your items to Messaging Menu, 
you'll need to set up a server (basically the container connected to a .desktop file_ 
and any number of clients (entries) 
Each entry can contain a time (which'll be displayed like "30 min" or "2 h") 
or just a number (count), i.e you can add a client titled "Inbox" with a mails count 
Time in UM case 

Then, Notify API 
You SHOULD NOT use pynotify because it is based on Gtk2 and is deprecated 
Gir-Notify usage is very simple, like this: 
Notify.init('unity-mail') 
Notify.Notification.new(title, message, icon).show() 
You can see more advanced-usage examples in 'tests' directory 
of libnotify tarball 
And there is one another important component - GNOME Keyring 
Currently there's no Gir for it - wait a moment, I'll find a bug about that 
It's https://bugs.launchpad.net/ubuntu/+source/libgnome-keyring/+bug/802173 
and https://bugzilla.gnome.org/show_bug.cgi?id=598414 for upstream 
so we use python-gnomekeyring binding, 
which is the only reason for us not moving to Python3 
Also, it adds a Gtk2 dependency, so I really don't like it 
You can read more about it here: 
http://blogs.codecommunity.org/mindbending/bending-gnome-keyring-with-python-part-1/ 
Credits to Andre Ryser who added GNOME Keyring support to UM 

Now a bit about translations 
UM uses gettext for translations and Launchpad for hosting them 
Also, it uses desktop2gettext script to generate .po (source) files from .desktop files 
(There are actually 2 desktop files used in UM: 
The main, that displays in Launcher, and another one which is copied to your 
~/.config/autostart/ directory and is used for auto-starting Unity Mail) 
http://bazaar.launchpad.net/~chromium-team/chromium-browser/chromium-translations-tools.head/view/head:/desktop2gettext.py 
(Originally it was developed for Chromium) 
More about gettext: http://docs.python.org/library/gettext.html 
More about using Launchpad for translating your project: https://help.launchpad.net/Translations/YourProject 
There were even 2 sessions about this in previous AppDeveloperWeek 
And also we use Bazaar for hosting code. 
Now - some future plans for Unity Mail 
You know why Unity Mail is better than other mailing clients 
(like Thunderbird and Evolution) 
First, it's written especially for WebMail services 
When you click it's icon your mail is opened in a web browser 
It uses GMail links by default, but you can set your own in the new configuration dialog 
You can even set a custom command by starting the URL with 'Exec:' 
dpm, I plan to release 1.0 firstly 
dpm asked: have you thought about submitting Unity Mail for inclusion in Ubuntu? 
And I'll release it when there will be a gir for gnomekeyring 
and I'll be able to use Py3K 
So, some ideas for future versions: 
- More configuration options, like disabling Messaging Menu 
or even Unity Launcher :) 
- "Mark all as read" option 
- (I don't yet know if it's possible) - Opening a mail when you click on it in the Messaging Menu 
- And it really needs a new icon, maybe someone will help me with it? 
So, I think, that's all 
Please ask your questions 
There are 10 minutes remaining in the current session. 
gnomie asked: if i decided to give UM a try, will it conflict with thunderbird (which is already set up)? 
gnomie no, it won't 
is now known as jelmer 
If I have another five minutes, I'll advertise my another app - ReText editor 
It's an editor for markup languages, such as Markdown and reStructuredText 
It allows you to control all your formatting and storing documents in plain text files 
But it supports export to ODT, PDF, HTML and whatever you want via plugins 
Also it can upload documents to Google Docs 
And it supports tabs, which is very useful feature 
Screenshot: https://sourceforge.net/p/retext/screenshot/retext.png 
Web-site: http://retext.sourceforge.net/ 
There are 5 minutes remaining in the current session. 
It's available in my PPA, too (ppa:mitya57) 
thanks mitya57 for a great session! 
So, good bye (= 

MeetingLogs/appdevweek1109/UnityMailWebMailNotification (last edited 2011-09-08 12:53:41 by dpm)