display presence status

- Modify RecentContactsView so that it displays the number of unread
  messages as a number

- Modify PixbufManipulator so that it draws presence status if
  displayPresence parameter is set to true. It dispays presence status
  as a green circle in the corner of the avatar.

[SS: moved drawing call to PixbufManipulator from RecentContactsView]
[SS: fixed unread count being hardcoded to 10]

Tuleap: #1379
Change-Id: I1fda061d26f231e9d0bb82f044eac91ecdb74db8
Signed-off-by: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
diff --git a/src/recentcontactsview.cpp b/src/recentcontactsview.cpp
index 2d14c77..f903fba 100644
--- a/src/recentcontactsview.cpp
+++ b/src/recentcontactsview.cpp
@@ -102,22 +102,18 @@
     if (idx.isValid() && object.isValid()) {
         QVariant var_photo;
         if (auto person = object.value<Person *>()) {
-            var_photo = GlobalInstances::pixmapManipulator().contactPhoto(person, QSize(50, 50), false);
+            var_photo = GlobalInstances::pixmapManipulator().contactPhoto(person, QSize(50, 50), true);
         } else if (auto cm = object.value<ContactMethod *>()) {
             /* get photo, note that this should in all cases be the fallback avatar, since there
              * shouldn't be a person associated with this contact method */
-            var_photo = GlobalInstances::pixmapManipulator().callPhoto(cm, QSize(50, 50), false);
+            var_photo = GlobalInstances::pixmapManipulator().callPhoto(cm, QSize(50, 50), true);
         } else if (auto call = object.value<Call *>()) {
             if (call->type() == Call::Type::CONFERENCE) {
-                var_photo = GlobalInstances::pixmapManipulator().callPhoto(call, QSize(50, 50), false);
+                var_photo = GlobalInstances::pixmapManipulator().callPhoto(call, QSize(50, 50), true);
             }
         }
         if (var_photo.isValid()) {
-            std::shared_ptr<GdkPixbuf> photo = var_photo.value<std::shared_ptr<GdkPixbuf>>();
-
-            auto unread = idx.data(static_cast<int>(Ring::Role::UnreadTextMessageCount));
-
-            image.reset(ring_draw_unread_messages(photo.get(), unread.toInt()), g_object_unref);
+            image = var_photo.value<std::shared_ptr<GdkPixbuf>>();
         } else {
             // set the width of the cell rendered to the with of the photo
             // so that the other renderers are shifted to the right
@@ -279,6 +275,13 @@
                 {
                     text = g_markup_escape_text(duration.value<QString>().toUtf8().constData(), -1);
                 }
+                else
+                {
+                    auto unread = idx.data(static_cast<int>(Ring::Role::UnreadTextMessageCount)).toInt();
+                    if (unread > 0){
+                        text = g_markup_printf_escaped("<span color=\"red\" font_weight=\"bold\">%d</span>", unread);
+                    }
+                }
             }
             break;
             case Ring::ObjectType::Call:
@@ -623,7 +626,7 @@
         self,
         NULL);
 
-    /* call duration */
+    /* call duration or unread messages */
     renderer = gtk_cell_renderer_text_new();
     g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
     gtk_cell_area_box_pack_end(GTK_CELL_AREA_BOX(area), renderer, FALSE, FALSE, FALSE);