Show service icon on background
authorArtem Garmash <artemgarmash@gmail.com>
Sun, 24 Jan 2010 20:27:33 +0000 (22:27 +0200)
committerArtem Garmash <artem.garmash@nokia.com>
Sun, 27 Jun 2010 19:13:44 +0000 (22:13 +0300)
src/el-home-applet.c

index 03322fa..d287ab8 100644 (file)
@@ -113,6 +113,8 @@ struct _ELHomeAppletPrivate
         guint8 border_color[4];
         PangoFontDescription *font_desc;
 
+        GdkPixbuf *service_pixbuf;
+
         guint idle_id;
 
         cairo_surface_t *message_surface;
@@ -469,6 +471,13 @@ expose_event (GtkWidget *self, GdkEventExpose *event)
         cairo_pattern_destroy (grad);
 
         if (priv->message) {
+                if (priv->service_pixbuf) {
+                        gdk_cairo_set_source_pixbuf (cr,
+                                                     priv->service_pixbuf,
+                                                     0, 0);
+                        cairo_paint_with_alpha (cr, 0.5);
+                }
+
                 /* draw footer unread part bg */
                 rounded_rectangle (cr,
                                    0, C_HEIGHT - FOOTER_HEIGHT,
@@ -544,6 +553,11 @@ clean_state (ELHomeApplet *self)
 {
         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;
@@ -923,6 +937,30 @@ read_event (ELHomeApplet *self)
         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,
+                                                                         128,
+                                                                         0, NULL);
+                }
+        }
+
         if (it) g_object_unref (it);
 }