Ubuntu Lucid – indicate

I upgraded to ubuntu Lucid yesterday, and I was totally disappointed with the new user experience they are trying^Wforcing with their ‘indicate’ applet.

At first, I was not using indicate applet in Karmic, so after the upgrade I didn’t have the indicate applet neither.

  • Rhythmbox’s icon when not playing was modified to be blank&white but the icon when playing was not modified, so big inconsistency in the style.
  • Rhythmbox’s status icon behaviour is modified: it does not play/pause when middle click, right-click does nothing, left-click popup a revisited context-menu. There is no way to show/hide rb when clicking the status icon. Scrolling on the status icon does not change the volume of the playback anymore.
  • I don’t have the bluethoot icon anymore, but tbh it’s fine because I don’t use it anyway. But still, I see no way to add it back.
  • The volume applet is also removed from my panel with no way to add it back.

Then I decided to give a try to indicate applet, I get 4 icons:

  1. bluetooth: exactly the same than without indicate, no way to remove it;
  2. rhythmbox: with all the issues mentioned above;
  3. volume: exactly the same than without indicate, they just made the bar horizontal instead of vertical;
  4. IM: probably the worst, here are issues I had:
    • It force using evolution so it’s useless for thunderbird users like me.
    • the menu shows random contacts in it, I had no idea for which reason contacts appeared… turned out that it’s the last login/logout contact… there is no notification for that, so unless you have always the menu open you can’t understand any reason those contact are there.
    • Incoming call dialog to accept/reject the call steal your focus, so if you were typing, it will reject the call. Empathy upstream fix that by blinking the status icon instead of poping a dialog. Yes, WM people claims that’s fixed 15years ago, blablabla, but no, poping a dialog STEALS the focus.
    • incoming message just turn the icon green, nothing blinking, so it’s really hard to notice. Even with upstream behaviour where the icon is blinking, lots of users complain it’s not noticable…
    • how am I supposed to know if I’m connected to IM??? When booting it does not connect IM accounts automatically, I have to click the IM indicator applet and open the contact list, and then magically it connects my accounts… how discoverable is that??? Using Empathy upstream, you directly see in the notification area an icon for your presence, and if you didn’t start empathy, you see that the icon is not there. In contrast the indicator IM applet is always there with no visual difference for your presence.

As an empathy developer I would like to add a comment on the very poor communication they had with us. Last year they started patching Empathy to use libindicate. They pushed packages in ubuntu karmic (when it was still in dev) without consulting upstream at all. They pushed empathy packages as we use “git commit” and opened an upstream bug attaching the ‘final’ patch. Upstream made an enormous list of comments pointing issues with the patch. While they fixed most of them, we still got lot of bugs reported in upstream by ubuntu users, adding more work for upstream dev. Guillaume Desmottes even lost several *days* of work to fix a nasty empathy crasher that turned out to be ubuntu’s patch fault.

So my conclusion, for my personal use case (maybe other users are happy with it?) that indicator is at best the same as upstream behaviour, but what they changed is getting worst. I don’t blame Ubuntu for trying new user experience, it was a good idea to explore, really. But what makes me totally disappointed is that there is no way to get back to the upstream behaviour if the user choose to not have the indicator applet.

How to make a GObject singleton

A while back some people asked me to blog about how to make a GObject singleton. I think we are doing it right in Empathy’s code.

The most common way of doing a singleton is to add a function like that:

FooBar*
foo_bar_get_default (void)
{
  static FooBar *self = NULL;

  if (self == NULL)
    self = foo_bar_new ();

  return self;
}

It means that you should never unref the return value, and the singleton is leaked for the entire live of the process (unless you play some atexit magic). It also means that g_object_new(FOO_TYPE_BAR, NULL) will return a new object and not a singleton, which is not friendly for bindings.

Here is how we are doing it most of the time in Empathy:

static GObject*
constructor (GType type,
                 guint n_construct_params,
                 GObjectConstructParam *construct_params)
{
  static GObject *self = NULL;

  if (self == NULL)
    {
      self = G_OBJECT_CLASS (foo_bar_parent_class)->constructor (
          type, n_construct_params, construct_params);
      g_object_add_weak_pointer (self, (gpointer) &self);
      return self;
    }

  return g_object_ref (self);
}

static void
foo_bar_class_init (FooBarClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->constructor = constructor;
}

With that code, g_object_new() will return a singleton, and will always return a new ref. That means that you have to call g_object_unref() on the singleton once you don’t need it anymore, just like any normal object. If the last user of the singleton drops its ref, then the object is finalized (so there is no leak) and next time someone needs the singleton, a new one will be created (thanks to the weak pointer).

Of course to avoid object create/destroy ping-pong, you could want to keep a ref for the whole live of the process anyway, it really depend on your needs. But if you are writing a library, you cannot know in advance if the object will be needed for the whole live of the process, so it’s better to let the program using the library decide by managing the refcount itself.

Update: Thanks to Rony and Alexander for pointing me that this is not thread-safe. I think we have to use a mutex in that case. If someone has a better idea, please tell me 🙂

Common mistake with GtkMenu

While hacking on Empathy, I discovered that most GtkMenu were leaked everywhere in the code. It looks like a common mistake so I decided to blog about it. Maybe other projects are doing that as well. For me it’s something new I learned recently, sorry if everybody was already aware of that 🙂

How it works

gtk_menu_new() returns an initially unowned widget. It means that its refcount is 1 and the floating flag is set. When you call gtk_menu_popup() on it, an ref is temporarily added as long as the menu is shown. That means that its refcount is now 2 and the floating flag is still set.

Popup and forget

If you want to show the menu and forget, then after calling gtk_menu_popup() you have to clear the floating flag using g_object_ref_sink() then drop the ref you own using g_object_unref(). Like that the menu will only have 1 ref that will be dropped as soon as the menu is popped down. So your menu will be finalized.

Reuse your menu

If you want to keep a pointer to your menu to reuse it, you have to attach the menu to a widget, using gtk_menu_attach_to_widget(). That means the widget will become owner of your menu because it calls g_object_ref_sink() and will make sure the GdkScreen on the menu is the same than on the attach widget. So if ‘self’ is your widget on which you want to popup a menu, simply do priv->menu = gtk_menu_new(); gtk_menu_attach_to_widget (menu, self, NULL); then you can do gtk_menu_popup(priv->menu) when you want. Like that your menu will be finalized in the same time as self.

Using GtkUIManager

If your menu comes from a GtkUIManager, then it is already owned by the ui manager. That means that as long as you own a ref to the manager, you can use the menu. I think you should still attach the menu to your widget to make sure the GdkScreen is handled correctly. Can someone confirm this?

Empathy, Adium, Geolocalisation, Desktop sharing, and File transfer

Long time without empathy blogpost. Lots of things happened in the Empathy/Telepathy world recently. Here I’ll present 4 new exciting feature of the upcoming Empathy 2.27.3. It will be an impressive release with not less than 49 bugs fixed!

Adium

The one year old adium branch got finally merged. This adds support for Adium Message Style themes in empathy. Themes are made of html and javascript, rendered using WebkitGtk. Of course webkit is optional dependency and old style themes can still be used.

Unfortunately all themes are not totally supported yet. Please check our wiki page for more information.

Geolocalisation

Another long standing branch got merged into Empathy master to add geoclue and libchamplain support. That means that you can now publish your position to your contacts. Your position can be calculater based on a connected GPS, based on your IP, or set manually to a postal address. You can of course tweak Empathy preferences to not publish the exact position for privacy.

If you have contacts publishing their position in your contact list, you’ll be able to see a world map with a marker at his position. The map is rendered thanks to libchamplain and animated using Clutter. Of course the map data is provided by OpenStreeMap.

This was done by Pierre-Luc Beaudoin and he will blog soon with more details and mandatory screenshots.

Desktop sharing

Work has been done to share your desktop with your contacts. This is done by creating a Telepathy StreamTube with your contact and passing the VNC protocol through it. Telepathy StreamTube spec is now undrafted and considered stable.

Guillaume will soon blog with more details about this.

File transfer

And last feature: The file transfer support in Empathy got large improvements. It now support checksum to make sure the transfer succeeded, and soon will support resume.

Empathy moved to GNOME’s git

Long time no blogging…

Yesterday the git-team pushed the red button and started the git migration from SVN. I’m really happy to see GNOME going forward without too much flames.

We were using GIT for the Empathy developement for a long time now, thanks to a git mirror I maintained using git-svn. But now we have an official git repository hosted on GNOME server. So please, everyone who has branches based on the old repository, follow those instructions to migrate your work to the new repository. I already ported my personal repository and rebased all branches there, so if you are using it (cloned, or added as remote location) you will have to clone it again, or add it as remote location on a new clone of the official GNOME repository.

Once again, thanks to those who made all the work to make git.gnome.org happen!

Other Empathy news:

  • I released Empathy 2.26.1 with lots of bug fixes.
  • We opened Ubuntu jaunty ppa with up to date packages for empathy and the whole telepathy stack.
  • Development started on master for the 2.27.x branch. It contains all the fixes from 2.26.1 plus: A new presence chooser widget (Thanks to Davyd), ported to GtkBuilder instead of libglade, and more to come soon…

Empathy updates

I just released Empathy 2.24.0! I branched for GNOME 2.24 so trunk is now open for new stuff, see the roadmap for more details.

Matthew Paul Thomas wrote an interesting usability comparaison between Empathy and Pidgin. Some of the problems pointed by that document are already fixed in Empathy 2.24.0, others will be in 2.25.x.

And finally a personal note: I’m not searching for a job anymore. I work full-time for Collabora since September 1st. This means I’ll have less time for working on Empathy, but Collabora agreed to let me work on Empathy 1day per 2 weeks. So all contributions are appreciated, don’t let empathy’s development slowdown.

Adding more protocols to Empathy

Seems lots of users are complaining about the lack of supported protocols in Empathy. In fact all protocols implemented in libpurple are easy to enable with empathy thanks to telepathy-haze. All you need is a .profile file describing some features, the icons to use, etc.

So I’m adding those profiles by default now but I need some info about protocols I never used myself: gadugadu, myspace, qq, sametime, simple, snpp, zephyr.

1) I need to know yes or no those features are supported:

  • chat-p2p – Private chat.
  • chat-room – Chat with multiple users, the XMPP/IRC way, not MSN-like which is private chat where we can invite more members.
  • chat-room-list – List public rooms on a server, like XMPP/IRC do.
  • voice-p2p – Private audio call
  • contact-search –
  • split-account – account are in the form of user@server.com, in that case the “@server.com” can be omitted and replace by a default value. For example gtalk profile have that feature so you can type “myaccount” and it will be translated magically to “myaccount@gmail.com”
  • registration-ui -The possibility to register a new account on the server, like XMPP.
  • supports-avatars – Does contacts have avatars, can I set my own avatar.
  • supports-alias – Does contacts have alias, can I set my own alias.
  • supports-roster – Is there a list of contacts for that protocol?
  • video-p2p – Private video call

2) For protocols having split-account feature I need to know the default domain to use. For example the gtalk profile says to use “@gmail.com” if the user didn’t type his full ID.

3) For each of those presence I need to know yes or no they are supported by the protocol:

  • offline – obvious
  • available – when you are online, ready to chat
  • away – when you are af, automacitally when you don’t touch your computer for a while
  • extended-away – whn you are afk for a long tim, automatically set when you are away for a while
  • hidden – You are online but don’t want others to know that
  • do-not-disturb – You are working on other things and don’t want to chat

4) What is the name I should display for qq and xnpp?

If you are able to answer those questions please let a comment or send me and email.

Thanks.

Looking for a job

On September I finish my studies of computer science, so I start to search a job. I really enjoyed my current job at Collabora maintaining Empathy, I learned lots of things about the Free Software world and I would like to keep working on free software related projects if possible. My CV is available online here.

Do you guys know any company around the free software and GNOME looking for new employees? You can contact me by email to xclaesse@gmail.com

Back from Istanbul

 I’m back home. Istanbul was my 2nd guadec and it was really great. I meet lots of interesting people and we had a chance to discuss a bit about the future of Empathy with guys from the People and Soylent project

VCS was a big topic this year. Basicly it seems was can resume it to “svn VS git VS bzr”. I heard nobody speaking about any other VCS. My opinion as maintainer of Empathy on GNOME server:

  • CVS is almost equal to SVN, I’ve  seen no big change of my workflow. In both cases I assume branch is not possible. I know there is lots of scripts and stuff to make branch work a bit… but really, svn DON’T support branches AT ALL compared to git.
  • I’m using git-svn to keep git://git.collabora.co.uk/git/empathy.git in sync with SVN, that’s a pain.
  • All Empathy contributers are using git, only translators still use svn. Keeping svn only for translators (~3 commits per month in Empathy) is stupid. It will lead to some GNOME maintainers to just stop using SVN and move to their favourite system and we won’t have a central place to get GNOME code anymore. That will happen for sure if we don’t do something asap.
  • I have nothing against other DVCS like bzr, I’ve just never tryed them… I’m sure I can be happy with them just like I am with git. So I won’t complain if GNOME moves from svn to any other system, IMO svn is the worst of them all so it can only be an improvement.
  • Please stop speaking of “learning curve”, that makes no sence at all. A new contributor does “svn co <url> && edit files && svn diff > stuff.patch && attach to bugzilla”, using git that translates to “git clone <url> && edit files && git diff  > stuff.patch && attach to bugzilla”. You see, no change! Git is able to make more complex jobs but new contributors don’t need to know them.
  • Whatever to new system will be lots of developers won’t agree, so I think web admins should do just like the release team at guadec: “Here is the plan, and there is no question”. Sometimes there is no otherway to make things going forward. Btw, if the plan is to keep svn I would be really sad, but please announce “We are keeping svn at least until GNOME 3.0 OR $x years OR forever” so we can stop flames.

So far the only good argue I’ve heard against git is portability on Windows and difficulties to port the svn archive to git. I would like to know if that’s still true that git is impossible to run on windows (if it’s just difficult it doesn’t matter, windows is hard itself)? Does bzr make a better job on windows? Is it really difficult to translate an svn repository like gnome to git/bzr?

I really hope that issue will be fixed soon!