Empathy chat theme – call for designers

Empathy chat view has been supporting Adium themes for a long time now. Those themes are made of HTML, CSS and JS and are rendered using webkit-gtk. Empathy also supports build-in themes using a plain GtkTextView.

I’ve been working recently on improving empathy’s code to support the most recent theme spec as well as fixing rendering issues we had with some themes. I also added a theme preview is settings dialog.

Adium Theme Preview

Designers have been working hard to create the GNOME 3 look & feel, and I think a GNOME adium theme would be great to have for empathy chats. That theme would be shipped by empathy and set by default, so we could drop our GtkTextView-based themes for a massive code simplification.

This is a call for designers: We would like mockups, ideas, and finally a working adium theme to be used by empathy by default.

In a first step, gimped image of what we would like would be enough. Then we can start implementing it with the HTML/CSS.

Suggestions and ideas can be posted on the empathy bug #645920, or on the usability mailing list.

One week with GNOME3

I’ve installed GNOME 3 ppa on my ubuntu natty last week, and have been using it exclusively since then. To be honest I’ve been ranting a lot against GNOME3 before using it for my day to day activities, so I feel I should share my observations now that I really know it. Here are all the good and bad things I’ve seen, with no particular order. I’ll try not being too polemic (that’s hard exercise for me), please keep in mind I’m not pretending being a normal user; I’m a developer so my needs probably are different.

Bugs

I’ve reported most of the bugs/regressions/unusabilities I’ve observed in bugzilla during the week

648190 gnome-settin UNCO NumLock is not enabled by default
648153 gnome-shell UNCO typing on the desktop could start searching in overview
648138 gnome-shell UNCO Issue when swithing from/to dock station with external monitor
648137 gnome-settin UNCO wallpaper suddenly became white
648114 rhythmbox RESO NOTG Window does not always close when running gnome-shell
648106 gnome-shell UNCO My account just below IM presence in me-menu is confusing
648097 gnome-shell UNCO me-menu says I’m available, but I’m not until I start empathy
648096 gnome-shell UNCO inconvenient workspace handling when app needs restart
648094 gnome-shell RESO DUPL Impossible to change wallpaper from desktop
648093 gnome-shell RESO DUPL multimedia keys are not working from overview
648091 gnome-contro UNCO In shortcut tab, “+” and “-” buttons does nothing
648089 gnome-shell RESO DUPL can’t select “wikipedia” with keyboard
648088 nautilus RESO DUPL Impossible to move a file to trash with DELETE key
648087 gnome-tweak- UNCO gnome-shell does not show icons on desktop after login
648084 gnome-shell UNCO Network connected/disconnected notifications stay forever

gnome-tweak-tool

I think I’ve changed the default value for pretty much everything in that tool. I find it sad to unify all gnome-settings in a new shiny and consistent UI, and then rely on a completely different and inconsistent tool for the rest. I know it is extremely hard to define what options to show the user, but IMO this feels like an easy solution to avoid the problem instead of facing it. Maybe we could simply make gnome-tweak-tool just another “tweak” icon in gnome-control-center, so at least it gets linked from there. That would feel more integrated.

GNOME thinks I’m disabled people

Considering all the effort to keep UI as minimum as possible, with no applets on the panel, no way to tweak it at all, and still I’m forced to have that menu for disabled people on my panel. I completely agree it is important for people needing those options to have a way to quickly access them, but this seems really really overkill to me. At least this could be yet-another option in gnome-tweak-tool?

Also please rename those “universal access”; do I really have access to the whole universe in one click? At least this sound silly in the French translation…

ctr-del

I’m probably the last geek to use nautilus to manage my files instead of gnome-terminal, but this change in nautilus to use ctr-del to delete a file surprised me. For the first days I’ve been thinking it was just a bug that nautilus can’t delete files and I used right-click context menu to move to trash. Then I discovered by asking on IRC this was actually intentional!! I won’t even start telling this is wrong, but simply ask one simple questions: How is CTR-DEL discoverable? Pressing DELETE does nothing, just silently ignoring me. My first intuition was of course the context menu to move to trash, and no shortcut is shown there. Since any computer user since in win95 (or even earlier?) are familiar with DELETE key to delete a file, I think it is important to have some notification telling the user what to do.

me-menu

The menu on the right of my screen that kindly reminds me my name, next to the disabled-people-menu (not only GNOME thinks I’m blind, but also that I have Alzheimer), looks like an IM menu to me. It starts with my fullname (which I use as alias on my IM accounts) and a chat bubble icon like the new Empathy icon. Then it have Available/Busy items which are totally IM vocabulary, followed by “My account” which surprisingly does not open Empathy account settings… and this ends here, the rest has nothing to do with IM… I do totally like having IM being first-class citizen in GNOME UI, but something looks wrong here. Especially since when I boot the computer, the menu says I’m available, but all my empathy accounts are actually offline. Changing to busy, back to available, etc does not change my status in Empathy; unless I first start empathy’s contact list view. I know this is partly because Empathy/Telepathy are not yet ready to fully integrate IM into the core desktop.

My vision of Telepathy integration into the desktop, is that “Empathy” as an app does not really exist. We have views for different kind of IM informations (contact list, chats, file transfer, presence, account settings, etc). Those views are provided partly by empathy widgets, but also by gnome-shell itself (presence in me-menu, embedded chat). The views are apps started on-demand but are not THE im application. So empathy’s main window is (should) just a view of the contact list, it does not need to be running to be available on XMPP and receive IM messages.

I have great hopes for 3.2 😀

Embedded IM chats

This is totally awesome! I love it so much! My only concern is the empathy status icon still blinking even after I replied messages in the embedded chat. During the week I’ve almost never actually opened the empathy’s chat window, I’ve been always chatting in gnome-shell directly. If gnome-shell’s activities search could match my contacts names too and let start chat/call, I think I could even not need to see empathy’s UI at all.

non disturbing notifications

Thanks god for smartly hiding notifications, I’m spending much less time in liferea since I don’t see anymore when my RSS are refreshed. I also totally like the rhythmbox’s notification when changing song, that let you pause/skip easily without needing to open the rb window (I’m using multimedia keys most of the time though).

It could be improved a bit though, for example when a new IM message arrive when I was away, I don’t see any notification until I open that bottom panel.

The wow-effect

I think gnome-shell is a perfect balancing between modern OpenGL desktop, but still looking professional. When compiz started showing tones of technically impressive 3D effects, I’ve always though its nice, but not professional. Now gnome-shell succeed in take advantage of technology, but not over-using it.

Launchers

I though it would be worse, but still I’m missing my launchers for some apps. I’m used to open a lots of gnome-terminal everywhere, for example. I had launchers in my gnome-panel before. I’m getting used to keyboard shortcuts now, but still I miss them a bit. I wish the launcher bar in the activities view could be visible on my desktop, and smartly hide when a window is on the border, like the ubuntu unity.

multi desktop

This is also something I though it would be worse. But still I can’t get totally used to it. It should have a way to spin some desktops to they don’t get removed when empty. Since they are dynamically open/close, I sometimes get lost in my desktops, having the preview image when using ctr-alt-up/down could help I think.

Also I miss a direct way to switch desktop using the mouse. May I suggest having the desktop bar we see in activities visible on desktop too. Just like suggested for the launchers above, it would hide like it does for unity’s launcher bar.

The shutdown story

You’ll be surprised, but I personally don’t miss the shutdown option. I almost always suspend anyway. After important upgrades, ubuntu should add a reboot option there; is such distro extension possible? A tooltip or something could suggest ALT magic key to reboot/shutdown, though.

Google/Wikipedia

Wikipedia makes perfect sense for an Open project, but is GNOME paid (like Mozilla AFAIK) for that Google advertisement at least? Even Internet Explorer lets the choice.

Developer feeling

This is probably partly because I have less time to contribute to GNOME this year, but I feel its getting more difficult for developers not having full-time job working on GNOME to contribute. I see 2 main reasons for this:

  1. Gtk3 breakage: In previous cycles it was almost trivial to build Empathy master on latest stable Ubuntu release. Only a few telepathy packages were needed from a ppa. With this GNOME3 cycle, it was mostly impossible to even see what was being worked on. We had the choice between installing totally unstable distro (not even Ubuntu sadly) with a full GNOME3 desktop, or build the world with jhbuild, which I always considered (wrongly?) a pain to get stuff working.
  2. Decisions are more and more made by UX “experts” who knows better, and make their plan partly behind closed doors. I have to admit they did mostly an amazing work, but as user and occasional contributor, I feel I’ve lost my voice. I don’t think anymore I can change stuff that I don’t like in GNOME, not because of technical reasons, but because GNOME is now part of a bigger plan. This is probably a good thing for marketing, but makes the hacker in me sad.

Hopefully point 1 won’t be the case anymore for GNOME 3.1 cycle, and point 2 is maybe more a feeling than a reality and could surely be improved.

Importance of fallback mode

No, not everyone has OpenGL running just fine on linux yet, and no not only proprietary drivers are broken. Just 2 examples on my laptop with intel GPU:

  1. gnome-shell won’t startup in a VM using virt-manager
  2. Playing an OpenGL game with wine works just fine when I launch it from gnome2 desktop with metacity and not effect, but is terribly broken rendering when launch from gnome-shell.

My conclusion

GNOME3 is a good base for upcoming releases. Better than I’ve though before using it everyday, but still lots of place for improvement and not yet the perfect release I hoped. I only hope designers and main hackers will be flexible enough to let it involve to something that can make everyone happy, but still rigorous to keep a consistency. Hard task, really.

Telepathy-ssh renamed to ssh-contact and released

I’m glad to announce the first release of ssh-contact, previously known as telepathy-ssh but renamed because there is already so many telepathy-foo projects (mainly ConnectionManagers) that it could be confusing.

It now has a great interactive CLI, letting you select which IM contact to connect. Of course it display only the contacts who installed the ssh-contact service.

Distro packagers, you can find the ssh-contact 0.1 tarball here. I’ll probably host the project on freedesktop.org in the future.

Feedback would be appreciated!

SSH your IM contacts

Did you ever wanted to connect to your computer but couldn’t make an SSH connection because it is behind a NAT, dynamic IP or firewall? Telepathy-ssh is for you!

Telepathy-ssh is a simple client/service program that make an ssh connection through a telepathy Tube.

$ telepathy-ssh-client gabble/jabber/testman2_40jabber_2ebelnet_2ebe1 testman@jabber.belnet.be
xclaesse@127.0.0.1’s password:
Linux xclaesse-laptop 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04 LTS

Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/

Last login: Mon Jul 12 17:55:39 2010 from xclaesse-laptop
xclaesse@xclaesse-laptop:~$ exit
logout
Connection to 127.0.0.1 closed.

Of course I’m planning to make the CLI a bit better. At least I would like to let choose the account between a list instead of having to type its ID manually. You can know your accountID using “mc-tool list” command. Also since the telepathy tube creates a local socket on which the ssh client connects, you see that it says it’s connecting to “127.0.0.1”, is it possible to tell ssh client to display another hostname?

I wrote that tool to make easy to connect my mother’s computer remotely, whithout dealing with her dynamic IP and NAT. If you also find that tool useful, and have suggestions, feel free to post a comment, or even patches 🙂

Need help with non-latin alphabet

Felix Kaser is working for Collabora, writing EmpathyLiveSearch widget. It is a widget similar to N900’s HildonLiveSearch. The goal is to make easy to search in your contact list in a smart way. So it match only if words are starting with your search string. For example if you have a contact “Xavier Claessens”, typing “Xav” or “Cla” will show it, but not if you enter “ier” nor “ssens”. The match is of course case-insensitive, so typing “xav” will match as well.

Where things gets more complicated, is that our code also try to strip accentuation marks. For example if you have a contact “Gaëtan”, typing “gae” will match it. This is done using g_unicode_canonical_decomposition() and keep only the first unicode.

I’m writing unit tests for that matching algorithm to make sure it is working as wanted. Being French speaker, I can easily test that letters éèçàï, etc are stripped correctly to keep only the base letter without the accentuation marks. But I would like to include tests in other non-latin alphabets, like Arabic/Chinese/Corean/etc. I don’t know if such “accentuation marks” that can be stripped makes sense in any other alphabet, but if you know, please give me some example strings.

Strings must be encoded in UTF-8 of course!

Thanks.

Update: Empathy in git master now has the live search merged. Please give it a try and see if it maches your needs. It has the matching algorith described above, surely not perfect in all languages, but already better than nothing.

Of course, I’m interested in feedback, does it fail horribly with your language, or is it acceptable? All I can tell is it is perfect in French 😀

The nVidia “nouveau” driver

I’m using an “old” laptop with an nvidia geforce7 mainly as media center connected on my TV. Getting TV-Out working with the nvidia card always was a pain, had to install proprietary driver, pasting chrunks of settings found on random forums to xorg.conf, and repeat until it decide to work. Had to restart X server each time I want to switch from LCD to TV screen.

Recently I upgraded it (actually made fresh install) to Ubuntu Lucid, was prepared to spent hours to get the tvout working again… But I got totally impressed by the new “nouveau” driver installed by default now, TV-Out was working out of the box, I can setup it easily with gnome-display-properties, even the fn+F7 key binding was working to switch display between LCD-only, TV-only or clone TV-LCD.

So I decided to share this good news, thanks to all devs that made that possible! OpenSource: 1, nVidia: 0.

Empathy getting contact vCard support

Telepathy spec had for some times now the ‘ContactInfo’ interface to get a vCard from our IM contacts, and set one for ourself. This is currently only supported by telepathy-gabble (The jabber backend).

Now I added high-level API in telepathy-glib to get those vCard information from a TpContact and set our self vCard on a TpConnection. I also added UI in Empathy to view IM contact’s vCard and edit our own vCard.

mandatory screenshots:

The code for this is not yet merged, it is waiting for review. You can find git branches:

telepathy-glib and empathy

Update: This is not related to metacontacts. Current plan for that is using libfolks which is being developped by Collabora right now.

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.