#define MESSAGE_HEIGHT (C_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT)
#define MESSAGE_WIDTH (C_WIDTH - 2*HILDON_MARGIN_DEFAULT)
-#define BOX_RADIOUS 10
+#define SERVICE_ICON_SIZE 64
+
+#define BOX_RADIOUS 20
#define SCROLL_PERIOD 100 /* ms */
#define SCROLL_STEP 1 /* pixel */
#define NOTIFICATION_UI_DBUS_PATH "/org/freedesktop/Telepathy/Client/NotificationUI"
#define NOTIFICATION_UI_DBUS_IFACE "com.nokia.RtcomNotificationUi"
+static const gchar *conv_services[] = {"RTCOM_EL_SERVICE_SMS",
+ "RTCOM_EL_SERVICE_CHAT",
+ NULL};
+static const gchar *conv_event_types[] = {"RTCOM_EL_EVENTTYPE_SMS_INBOUND",
+ "RTCOM_EL_EVENTTYPE_CHAT_INBOUND",
+ NULL};
+
typedef enum {
SELECTED_NONE,
SELECTED_HEADER,
guint8 border_color[4];
PangoFontDescription *font_desc;
+ GdkPixbuf *service_pixbuf;
+
guint idle_id;
cairo_surface_t *message_surface;
cairo_pattern_destroy (grad);
if (priv->message) {
+ if (priv->service_pixbuf) {
+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+ gdk_cairo_set_source_pixbuf (cr,
+ priv->service_pixbuf,
+ C_WIDTH - SERVICE_ICON_SIZE,
+ C_HEIGHT - FOOTER_HEIGHT - SERVICE_ICON_SIZE);
+ cairo_paint_with_alpha (cr, 0.3);
+ }
+
/* draw footer unread part bg */
rounded_rectangle (cr,
0, C_HEIGHT - FOOTER_HEIGHT,
{
ELHomeAppletPrivate *priv = self->priv;
+ if (priv->service_pixbuf) {
+ g_object_unref (priv->service_pixbuf);
+ priv->service_pixbuf = NULL;
+ }
+
if (priv->message) {
g_free (priv->message);
priv->message = NULL;
gtk_label_set_text (GTK_LABEL (priv->sender),
osso_abook_contact_get_display_name (priv->contact));
- avatar_image = osso_abook_avatar_get_image_rounded
+ avatar_image = osso_abook_avatar_get_image_scaled /*rounded*/
(OSSO_ABOOK_AVATAR (priv->contact),
HILDON_ICON_PIXEL_SIZE_THUMB,
HILDON_ICON_PIXEL_SIZE_THUMB,
- TRUE,
- -1,
- priv->border_color);
+ TRUE);
+ /* -1, */
+ /* priv->border_color); */
if (avatar_image) {
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->avatar),
show_event (ELHomeApplet *self, RTComElIter *it)
{
ELHomeAppletPrivate *priv = self->priv;
- gchar *remote = NULL;
+ const gchar *remote = NULL;
gchar *received = NULL;
- /* const gchar *icon_name = NULL; */
+ GValueArray *event = NULL;
if (it && rtcom_el_iter_first (it)) {
- rtcom_el_iter_dup_string (it, "free-text", &priv->message);
- if (priv->message) {
- /* const gchar *service; */
- time_t received_t;
- rtcom_el_iter_get_int (it, "id", &priv->event_id);
- if (rtcom_el_iter_get_int (it, "start-time", (gint*)&received_t))
- received = format_time (received_t);
-
- if (rtcom_el_iter_dup_string (it, "remote-uid", &priv->remote_id)) {
- if (priv->remote_id && priv->remote_id[0]) {
- if (!rtcom_el_iter_dup_string (it, "remote-name", &remote))
- remote = g_strdup (priv->remote_id);
-
- rtcom_el_iter_dup_string (it, "remote-ebook-uid", &priv->contact_id);
- rtcom_el_iter_dup_string (it, "local-uid", &priv->local_id);
- }
- else if (priv->remote_id) {
- g_free (priv->remote_id);
- priv->remote_id = NULL;
- }
+ event = rtcom_el_iter_get_valuearray (it,
+ "id",
+ "start-time",
+ "local-uid",
+ "remote-uid",
+ "remote-name",
+ "remote-ebook-uid",
+ "free-text",
+ "group-uid",
+ NULL);
+ if (event) {
+ time_t received_t;
+#define _VARR_DUP_STR(array, i) g_value_dup_string (g_value_array_get_nth ((array), (i)))
+
+ priv->event_id = g_value_get_int (g_value_array_get_nth (event, 0));
+ received_t = g_value_get_int (g_value_array_get_nth (event, 1));
+ received = format_time (received_t);
+ priv->local_id = _VARR_DUP_STR (event, 2);
+ priv->remote_id = _VARR_DUP_STR (event, 3);
+ if (priv->remote_id && priv->remote_id[0]) {
+ remote = g_value_get_string (g_value_array_get_nth (event, 4));
+ if (!remote)
+ remote = priv->remote_id;
+ priv->contact_id = _VARR_DUP_STR (event, 5);
}
- rtcom_el_iter_dup_string (it, "group-uid", &priv->group_uid);
-#if 0
- service = rtcom_el_iter_get_service (it);
- if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_SMS"))
- icon_name = "chat_unread_sms";
- else if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_CHAT"))
- icon_name = "chat_unread_chat";
-#endif
+ else if (priv->remote_id) {
+ g_free (priv->remote_id);
+ priv->remote_id = NULL;
+ }
+
+ priv->message = _VARR_DUP_STR (event, 6);
+ priv->group_uid = _VARR_DUP_STR (event, 7);
+
+#undef _VARR_DUP_STR
}
}
else {
gtk_label_set_text (GTK_LABEL (priv->received), received);
-#if 0
- gtk_widget_hide (priv->avatar);
- if (icon_name) {
- const gchar *current_icon_name;
- gtk_image_get_icon_name (GTK_IMAGE (priv->icon),
- ¤t_icon_name,
- NULL);
- if (g_strcmp0 (current_icon_name, icon_name))
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->icon),
- icon_name,
- HILDON_ICON_SIZE_FINGER);
- gtk_widget_show (priv->icon);
- }
- else
- gtk_widget_hide (priv->icon);
-#endif
-
if (remote)
gtk_label_set_text (GTK_LABEL (priv->sender), remote);
else
gtk_label_set_text (GTK_LABEL (priv->sender), priv->remote_id);
- g_free (remote);
stop_scroll_anim (priv);
priv->scroll_offset = 0;
priv->message_surface = NULL;
}
+ if (event)
+ g_value_array_free (event);
+
gtk_widget_hide (priv->cut_message);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
RTComElQuery *query = NULL;
RTComElIter *it = NULL;
- static const gchar *services[] = {"RTCOM_EL_SERVICE_SMS",
- "RTCOM_EL_SERVICE_CHAT",
- NULL};
- static const gchar *event_types[] = {"RTCOM_EL_EVENTTYPE_SMS_INBOUND",
- "RTCOM_EL_EVENTTYPE_CHAT_INBOUND",
- NULL};
-
query = rtcom_el_query_new (el);
rtcom_el_query_set_limit (query, 1);
if (event_id >= 0) {
rtcom_el_query_prepare (query,
- "is-read", FALSE, RTCOM_EL_OP_EQUAL,
"id", event_id, RTCOM_EL_OP_EQUAL,
- "service", services, RTCOM_EL_OP_IN_STRV,
- "event-type", event_types, RTCOM_EL_OP_IN_STRV,
NULL);
}
else {
rtcom_el_query_prepare (query,
"is-read", FALSE, RTCOM_EL_OP_EQUAL,
- "service", services, RTCOM_EL_OP_IN_STRV,
- "event-type", event_types, RTCOM_EL_OP_IN_STRV,
+ "service", conv_services, RTCOM_EL_OP_IN_STRV,
+ /* "event-type", conv_event_types, RTCOM_EL_OP_IN_STRV, */
NULL);
}
it = rtcom_el_get_events (el, query);
it = make_query (priv->eventlogger, -1);
show_event (self, it);
resolve_contact (self);
+
+ if (g_strcmp0 (priv->local_id, "ring/tel/ring" == 0)) {
+ McAccount *account;
+ const gchar *icon_name = NULL;
+ account = osso_abook_account_manager_lookup_by_name (NULL,
+ priv->local_id);
+ if (account) {
+ McProfile *profile = mc_profile_lookup (mc_account_compat_get_profile (account));
+ icon_name = mc_profile_get_icon_name (profile);
+ }
+ if (icon_name) {
+ GdkScreen *screen;
+ GtkIconTheme *icon_theme;
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (self));
+ icon_theme = gtk_icon_theme_get_for_screen (screen);
+
+ priv->service_pixbuf = gtk_icon_theme_load_icon (icon_theme,
+ icon_name,
+ SERVICE_ICON_SIZE,
+ 0, NULL);
+ }
+ }
+
if (it) g_object_unref (it);
}
const gchar *service,
ELHomeApplet *self)
{
- /* TODO: avoid updating if not related */
- add_new_idle (self);
+ const gchar** conv_service = conv_services;
+
+ do {
+ if (!g_strcmp0 (*conv_service, service)) {
+ add_new_idle (self);
+ return;
+ }
+ }
+ while(++conv_service);
}
static gboolean