Simplify and make more robust updating events
[conv-inbox] / src / el-home-applet.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2 /*
3  *  Copyright (C) 2009 Artem Garmash. All rights reserved.
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * Contact: Artem Garmash <artemgarmash@gmail.com>
20  *
21  */
22
23 #include "config.h"
24 #include "el-home-applet.h"
25
26 #include <hildon/hildon.h>
27 #include <rtcom-eventlogger/eventlogger.h>
28 #include <sqlite3.h>
29 #include <string.h>
30
31 #define EL_HOME_APPLET_GET_PRIVATE(obj) ( \
32         G_TYPE_INSTANCE_GET_PRIVATE (obj, \
33                 EL_TYPE_HOME_APPLET, ELHomeAppletPrivate))
34
35 #define BOX_WIDTH 352
36 #define BOX_HEIGHT 266
37
38 #define C_WIDTH (BOX_WIDTH - 2*HILDON_MARGIN_HALF)
39 #define C_HEIGHT (BOX_HEIGHT - 2*HILDON_MARGIN_HALF)
40 #define C_X HILDON_MARGIN_HALF
41 #define C_Y HILDON_MARGIN_HALF
42
43 #define HEADER_HEIGHT 48
44 #define MESSAGE_HEIGHT (C_HEIGHT - HEADER_HEIGHT)
45 #define MESSAGE_WIDTH (C_WIDTH - 2*HILDON_MARGIN_DEFAULT)
46
47 #define BOX_RADIOUS 10
48
49 struct _ELHomeAppletPrivate
50 {
51         RTComEl *eventlogger;
52
53         GtkWidget *sender;
54         GtkWidget *message;
55         GtkWidget *icon;
56         GtkWidget *unread;
57         GtkWidget *received;
58         GtkWidget *empty;
59
60         gint       event_id;
61
62         gboolean   active;
63
64         guint unread_count;
65
66         const gchar *current_font;
67
68         guint idle_id;
69 };
70
71 HD_DEFINE_PLUGIN_MODULE (ELHomeApplet, el_home_applet, HD_TYPE_HOME_PLUGIN_ITEM);
72
73 const gchar* g_module_check_init(GModule *module);
74 const gchar*
75 g_module_check_init(GModule *module)
76 {
77         g_module_make_resident (module);
78         return NULL;
79 }
80
81 static void
82 el_home_applet_class_finalize (ELHomeAppletClass *klass)
83 {
84 }
85
86 static void
87 el_home_applet_realize (GtkWidget *widget)
88 {
89         GdkScreen *screen;
90
91         screen = gtk_widget_get_screen (widget);
92         gtk_widget_set_colormap (widget,
93                                  gdk_screen_get_rgba_colormap (screen));
94
95         gtk_widget_set_app_paintable (widget,
96                                       TRUE);
97
98         GTK_WIDGET_CLASS (el_home_applet_parent_class)->realize (widget);
99 }
100
101 /*
102  * Thanks http://cairographics.org/cookbook/roundedrectangles/
103  */
104 static void
105 rounded_rectangle (cairo_t *cr,
106                    double   x,
107                    double   y,
108                    double   w,
109                    double   h,
110                    double   r)
111 {
112         cairo_move_to (cr, x + r, y);
113         cairo_line_to (cr, x + w - r, y);
114         cairo_curve_to (cr, x + w, y,
115                         x + w, y,
116                         x + w, y + r);
117         cairo_line_to (cr, x + w, y + h - r);
118         cairo_curve_to (cr, x + w, y + h,
119                         x + w, y + h,
120                         x + w - r, y + h);
121         cairo_line_to (cr, x + r, y + h);
122         cairo_curve_to (cr, x, y + h,
123                         x, y + h,
124                         x, y + h - r);
125         cairo_line_to (cr, x, y + r);
126         cairo_curve_to (cr, x, y,
127                         x, y,
128                         x + r, y);
129 }
130
131 static gboolean
132 expose_event (GtkWidget *self, GdkEventExpose *event)
133 {
134         ELHomeAppletPrivate *priv = EL_HOME_APPLET(self)->priv;
135
136         cairo_t *cr;
137         GdkColor color;
138         float red, green, blue;
139
140         /* find theme active color */
141         gtk_style_lookup_color (self->style, "ActiveTextColor", &color);
142         red = color.red/(float)G_MAXUINT16;
143         green = color.green/(float)G_MAXUINT16;
144         blue = color.blue/(float)G_MAXUINT16;
145
146         cr = gdk_cairo_create (self->window);
147         gdk_cairo_region (cr, event->region);
148         cairo_clip (cr);
149
150         /* draw bound box */
151         cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
152
153         cairo_set_source_rgba (cr, 0.4f, 0.4f, 0.4f, 0.1f);
154         cairo_set_line_width (cr, 3.0f);
155
156         rounded_rectangle (cr,
157                            C_X,
158                            C_Y,
159                            BOX_WIDTH - 2*C_X,
160                            BOX_HEIGHT - 2*C_Y,
161                            BOX_RADIOUS);
162
163         cairo_close_path(cr);
164         cairo_stroke (cr);
165
166         /* draw header */
167         cairo_set_line_width (cr, 1.0f);
168
169         cairo_translate (cr, C_X, C_Y);
170         cairo_move_to (cr, 0, HEADER_HEIGHT);
171         cairo_line_to (cr, 0, BOX_RADIOUS);
172         cairo_curve_to (cr, 0, 0, 0, 0, BOX_RADIOUS, 0);
173         cairo_line_to (cr, C_WIDTH - BOX_RADIOUS, 0);
174         cairo_curve_to (cr, C_WIDTH, 0, C_WIDTH, 0, C_WIDTH, BOX_RADIOUS);
175         cairo_line_to (cr, C_WIDTH, HEADER_HEIGHT);
176         cairo_line_to (cr, 0, HEADER_HEIGHT);
177
178         cairo_close_path(cr);
179
180         cairo_set_source_rgba (cr, 0.2f, 0.2f, 0.2f, 0.8f);
181         cairo_fill_preserve (cr);
182         cairo_set_source_rgba (cr, red, green, blue, 1.0f);
183         cairo_stroke (cr);
184
185         /* draw body */
186         cairo_move_to (cr, 0, HEADER_HEIGHT);
187         cairo_line_to (cr, 0, C_HEIGHT - BOX_RADIOUS);
188         cairo_curve_to (cr, 0, C_HEIGHT, 0, C_HEIGHT, BOX_RADIOUS, C_HEIGHT);
189         cairo_line_to (cr, C_WIDTH - BOX_RADIOUS, C_HEIGHT);
190         cairo_curve_to (cr, C_WIDTH, C_HEIGHT, C_WIDTH, C_HEIGHT, C_WIDTH, C_HEIGHT - BOX_RADIOUS);
191         cairo_line_to (cr, C_WIDTH, HEADER_HEIGHT);
192         cairo_line_to (cr, 0, HEADER_HEIGHT);
193         cairo_close_path(cr);
194
195         /* draw body filling depending on (in)active state */
196         cairo_pattern_t *grad;
197         grad = cairo_pattern_create_linear(0, HEADER_HEIGHT,
198                                            0, C_HEIGHT);
199
200         if (priv->active){
201                 cairo_pattern_add_color_stop_rgba (grad, 0.5f,
202                                                    red, green, blue, 0.8f);
203                 cairo_pattern_add_color_stop_rgba (grad, 1.0f,
204                                                    red/2, green/2, blue/2, 0.8f);
205         }
206         else {
207                 cairo_pattern_add_color_stop_rgba (grad, 0.5f,
208                                                    0.4f, 0.4f, 0.4f, 0.8f);
209                 cairo_pattern_add_color_stop_rgba (grad, 1.0f,
210                                                    0.2f, 0.2f, 0.2f, 0.8f);
211         }
212         cairo_set_source (cr, grad);
213         cairo_fill (cr);
214
215         /* cairo_set_source_rgba (cr, red, green, blue, 1.0f); */
216         /* cairo_translate (cr, -C_X, -C_Y); */
217         /* rounded_rectangle (cr, */
218         /*                    C_X, */
219         /*                    C_Y, */
220         /*                    BOX_WIDTH - 2*C_X, */
221         /*                    BOX_HEIGHT - 2*C_Y, */
222         /*                    BOX_RADIOUS); */
223         /* cairo_close_path(cr); */
224         /* cairo_stroke (cr); */
225         cairo_pattern_destroy (grad);
226         cairo_destroy (cr);
227
228         return GTK_WIDGET_CLASS (el_home_applet_parent_class)->expose_event (self, event);
229 }
230
231 static void
232 dispose (GObject *self)
233 {
234         ELHomeAppletPrivate *priv = EL_HOME_APPLET(self)->priv;
235
236         if (priv->idle_id){
237                 g_source_remove (priv->idle_id);
238                 priv->idle_id = 0;
239         }
240         if (priv->eventlogger){
241                 g_object_unref (priv->eventlogger);
242                 priv->eventlogger = NULL;
243         }
244
245         G_OBJECT_CLASS (el_home_applet_parent_class)->dispose (self);
246 }
247
248 static void
249 finalize (GObject *self)
250 {
251         G_OBJECT_CLASS (el_home_applet_parent_class)->finalize (self);
252 }
253
254 static gchar*
255 format_time (time_t t)
256 {
257         static const guint RESULT_SIZE = 32;
258
259         time_t now;
260         struct tm now_tm, t_tm;
261         const gchar *format = "%Y.%m.%d %T";
262         gchar *result = g_malloc0 (RESULT_SIZE);
263
264         now = time (NULL);
265         localtime_r (&now, &now_tm);
266         localtime_r (&t, &t_tm);
267
268         if ((now_tm.tm_year == t_tm.tm_year) &&
269             (now_tm.tm_mon  == t_tm.tm_mon) &&
270             (now_tm.tm_mday == t_tm.tm_mday))
271                 format = "%T";
272
273         strftime (result, RESULT_SIZE, format, &t_tm);
274
275         return result;
276 }
277
278 static void
279 show_event (ELHomeApplet *self, RTComElIter *it)
280 {
281         ELHomeAppletPrivate *priv = self->priv;
282
283         gchar *message = NULL;
284         gchar *remote = NULL;
285         gchar *received = NULL;
286         const gchar *icon_name = NULL;
287
288         if (it && rtcom_el_iter_first (it)){
289                 rtcom_el_iter_dup_string (it, "free-text", &message);
290                 if (message){
291                         const gchar *service;
292                         time_t received_t;
293
294                         rtcom_el_iter_get_int (it, "id", &priv->event_id);
295                         if (rtcom_el_iter_get_int (it, "start-time", (gint*)&received_t))
296                                 received = format_time (received_t);
297
298                         if(!rtcom_el_iter_dup_string (it, "remote-name", &remote))
299                                 rtcom_el_iter_dup_string (it, "remote-id", &remote);
300                         service = rtcom_el_iter_get_service (it);
301                         if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_SMS"))
302                                 icon_name = "chat_unread_sms";
303                         else if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_CHAT"))
304                                 icon_name = "chat_unread_chat";
305                 }
306         }
307         else{
308                 priv->event_id = -1;
309         }
310
311         if (message){
312                 if (!GTK_WIDGET_VISIBLE (priv->message))
313                         gtk_widget_show (priv->message);
314                 gtk_label_set_text (GTK_LABEL (priv->message), message);
315         }
316         else{
317                 gtk_widget_hide (priv->message);
318                 gtk_widget_show (priv->empty);
319         }
320
321         gtk_label_set_text (GTK_LABEL (priv->sender), remote);
322         gtk_label_set_text (GTK_LABEL (priv->received), received);
323
324         if (icon_name){
325                 const gchar *current_icon_name;
326                 gtk_image_get_icon_name (GTK_IMAGE (priv->icon),
327                                          &current_icon_name,
328                                          NULL);
329                 if (g_strcmp0 (current_icon_name, icon_name))
330                         gtk_image_set_from_icon_name (GTK_IMAGE (priv->icon),
331                                                       icon_name,
332                                                       HILDON_ICON_SIZE_FINGER);
333                 gtk_widget_show (priv->icon);
334         }
335         else
336                 gtk_widget_hide (priv->icon);
337
338         g_free (message);
339         g_free (remote);
340 }
341
342 static RTComElIter*
343 make_query (RTComEl *el, gint event_id)
344 {
345         RTComElQuery *query = NULL;
346         RTComElIter *it = NULL;
347
348         static const gchar *services[] = {"RTCOM_EL_SERVICE_SMS",
349                                           "RTCOM_EL_SERVICE_CHAT",
350                                           NULL};
351         static const gchar *event_types[] = {"RTCOM_EL_EVENTTYPE_SMS_INBOUND",
352                                              "RTCOM_EL_EVENTTYPE_CHAT_INBOUND",
353                                              NULL};
354
355         query = rtcom_el_query_new (el);
356         rtcom_el_query_set_limit (query, 1);
357         if (event_id >= 0){
358                 rtcom_el_query_prepare (query,
359                                         "is-read", FALSE, RTCOM_EL_OP_EQUAL,
360                                         "id", event_id, RTCOM_EL_OP_EQUAL,
361                                         "service", services, RTCOM_EL_OP_IN_STRV,
362                                         "event-type", event_types, RTCOM_EL_OP_IN_STRV,
363                                         NULL);
364         }
365         else{
366                 rtcom_el_query_prepare (query,
367                                         "is-read", FALSE, RTCOM_EL_OP_EQUAL,
368                                         "service", services, RTCOM_EL_OP_IN_STRV,
369                                         "event-type", event_types, RTCOM_EL_OP_IN_STRV,
370                                         NULL);
371         }
372         it = rtcom_el_get_events (el, query);
373         g_object_unref(query);
374
375         return it;
376 }
377
378 static void
379 update_unread_label (ELHomeApplet *self)
380 {
381         ELHomeAppletPrivate *priv = self->priv;
382         gchar *text;
383
384         if (priv->unread_count > 0){
385                 text = g_strdup_printf ("%d", priv->unread_count);
386                 gtk_label_set_text (GTK_LABEL (priv->unread), text);
387                 g_free (text);
388         }
389         else
390                 gtk_label_set_text (GTK_LABEL (priv->unread), NULL);
391 }
392
393 static gint
394 query_unread_events (RTComEl *el)
395 {
396         sqlite3 *db;
397         sqlite3_stmt *stmt;
398         int ret;
399         gint count = 0;
400
401         g_object_get (el, "db", &db, NULL);
402
403         if (sqlite3_prepare_v2 (db,
404                                 "SELECT SUM(total_events)-SUM(read_events) FROM GroupCache;",
405                                 -1,
406                                 &stmt,
407                                 NULL) != SQLITE_OK){
408                 g_error ("%s: can't compile SQL", G_STRFUNC);
409                 return -1;
410         }
411
412         while (SQLITE_BUSY == (ret = sqlite3_step (stmt)));
413
414         if (ret == SQLITE_ROW){
415                 count = sqlite3_column_int (stmt, 0);
416         }
417         else{
418                 g_error ("%s: error while executing SQL", G_STRFUNC);
419         }
420
421         sqlite3_finalize (stmt);
422
423         return count;
424 }
425
426 static void
427 read_event (ELHomeApplet *self)
428 {
429         ELHomeAppletPrivate *priv = self->priv;
430         RTComElIter *it = NULL;
431
432         it = make_query (priv->eventlogger, -1);
433         show_event (self, it);
434         if (it) g_object_unref (it);
435 }
436
437 static void
438 mark_as_read (ELHomeApplet *self)
439 {
440         ELHomeAppletPrivate *priv = self->priv;
441
442         if (priv->event_id >= 0){
443                 rtcom_el_set_read_event (priv->eventlogger,
444                                          priv->event_id,
445                                          TRUE,
446                                          NULL);
447                 read_event (self);
448                 priv->unread_count--;
449                 update_unread_label (self);
450         }
451 }
452
453 static gboolean
454 read_new_event (ELHomeApplet *self)
455 {
456         ELHomeAppletPrivate *priv = self->priv;
457
458         read_event (self);
459         priv->unread_count = query_unread_events (priv->eventlogger);
460         update_unread_label (self);
461
462         priv->idle_id = 0;
463
464         return FALSE;
465 }
466
467 static void
468 add_new_idle (ELHomeApplet *self)
469 {
470         ELHomeAppletPrivate *priv = self->priv;
471
472         if (priv->idle_id)
473                 g_source_remove (priv->idle_id);
474         priv->idle_id = g_idle_add ((GSourceFunc)read_new_event,
475                                     self);
476 }
477
478 static void
479 new_event_cb (RTComEl      *backend,
480               gint          event_id,
481               const gchar  *local_uid,
482               const gchar  *remote_uid,
483               const gchar  *remote_ebook_uid,
484               const gchar  *group_uid,
485               const gchar  *service,
486               ELHomeApplet *self)
487 {
488         add_new_idle (self);
489 }
490
491 static gboolean
492 button_release_event_cb (GtkWidget      *widget,
493                          GdkEventButton *event,
494                          ELHomeApplet   *self)
495 {
496         ELHomeAppletPrivate *priv = self->priv;
497
498         if (priv->active){
499                 priv->active = FALSE;
500                 gtk_widget_queue_draw (widget);
501 #ifndef DEBUG_LAYOUT
502                 mark_as_read (self);
503 #endif
504         }
505
506         return TRUE;
507 }
508
509 static gboolean
510 button_press_event_cb (GtkWidget      *widget,
511                        GdkEventButton *event,
512                        ELHomeApplet   *self)
513 {
514         ELHomeAppletPrivate *priv = self->priv;
515
516         if (priv->event_id > 0){
517                 priv->active = TRUE;
518                 gtk_widget_queue_draw (widget);
519         }
520
521         return TRUE;
522 }
523
524 static gboolean
525 leave_notify_event_cb (GtkWidget        *widget,
526                        GdkEventCrossing *event,
527                        ELHomeApplet     *self)
528 {
529         ELHomeAppletPrivate *priv = self->priv;
530
531         if (priv->active){
532                 priv->active = FALSE;
533                 gtk_widget_queue_draw (widget);
534         }
535
536         return FALSE;
537 }
538
539 static void
540 el_home_applet_init (ELHomeApplet *self)
541 {
542         ELHomeAppletPrivate *priv;
543         GtkWidget *event_box;
544         GtkWidget *hbox, *vbox, *align;
545
546         self->priv = EL_HOME_APPLET_GET_PRIVATE (self);
547         priv = self->priv;
548
549         gtk_widget_set_app_paintable (GTK_WIDGET (self), TRUE);
550
551         priv->unread = gtk_label_new ("12");
552         hildon_helper_set_logical_color (priv->unread,
553                                          GTK_RC_FG,
554                                          GTK_STATE_NORMAL,
555                                          "ActiveTextColor");
556         gtk_misc_set_alignment (GTK_MISC (priv->unread),
557                                 1.0f,
558                                 0.5f);
559         gtk_widget_set_size_request (priv->unread,
560                                      -1,
561                                      HEADER_HEIGHT);
562
563         priv->icon = gtk_image_new_from_icon_name ("chat_unread_sms",
564                                                    HILDON_ICON_SIZE_FINGER);
565         gtk_misc_set_alignment (GTK_MISC (priv->icon),
566                                 0.5f,
567                                 0.5f);
568
569         priv->sender = gtk_label_new ("asdf asdf asdf asdf asdf");
570         gtk_misc_set_alignment (GTK_MISC (priv->sender),
571                                 0.5f,
572                                 0.5f);
573         gtk_label_set_ellipsize (GTK_LABEL (priv->sender),
574                                  PANGO_ELLIPSIZE_END);
575         gtk_widget_set_name (priv->sender, "hildon-shadow-label");
576         hildon_helper_set_logical_font (priv->sender, "SystemFont");
577
578         priv->message = g_object_new (GTK_TYPE_LABEL,
579                                       "label", "asdf asdf adsf asdf asdf asdf asdf asdf",
580                                       "wrap", TRUE,
581                                       "wrap-mode", PANGO_WRAP_WORD_CHAR,
582                                       NULL);
583
584         gtk_misc_set_alignment (GTK_MISC (priv->message),
585                                 0.0f,
586                                 0.0f);
587         gtk_widget_set_size_request (priv->message,
588                                      MESSAGE_WIDTH,
589                                      MESSAGE_HEIGHT);
590         gtk_widget_set_name (priv->message, "hildon-shadow-label");
591
592         /* TODO: l10n */
593         priv->empty = gtk_label_new ("No new messages");
594         gtk_widget_set_name (priv->empty, "hildon-shadow-label");
595         GTK_WIDGET_SET_FLAGS (priv->empty, GTK_NO_SHOW_ALL);
596
597         priv->received = gtk_label_new ("aewf aewf aewf awef");
598         gtk_misc_set_alignment (GTK_MISC (priv->received),
599                                 1.0f,
600                                 0.5f);
601         gtk_widget_set_size_request (priv->received,
602                                      MESSAGE_WIDTH,
603                                      -1);
604         hildon_helper_set_logical_font (priv->received, "SmallSystemFont");
605         gtk_widget_set_name (priv->received, "hildon-shadow-label");
606
607         hbox = gtk_hbox_new (FALSE, 0);
608         gtk_box_pack_start (GTK_BOX (hbox), priv->unread, FALSE, FALSE, 0);
609         gtk_box_pack_start (GTK_BOX (hbox), priv->icon, FALSE, FALSE, 0);
610         gtk_box_pack_start (GTK_BOX (hbox), priv->sender, TRUE, TRUE, 0);
611
612         vbox = gtk_vbox_new (FALSE, 0);
613         gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
614         gtk_box_pack_start (GTK_BOX (vbox), priv->message, TRUE, TRUE, 0);
615         gtk_box_pack_start (GTK_BOX (vbox), priv->empty, FALSE, FALSE, 0);
616         gtk_box_pack_start (GTK_BOX (vbox), priv->received, FALSE, FALSE, 0);
617
618         align = gtk_alignment_new (0.5f, 0.0f, 1.0f, 1.0f);
619         gtk_alignment_set_padding (GTK_ALIGNMENT (align),
620                                    0, 0, HILDON_MARGIN_DEFAULT, HILDON_MARGIN_DEFAULT);
621
622         gtk_container_set_border_width (GTK_CONTAINER (vbox), HILDON_MARGIN_HALF);
623
624         event_box = gtk_event_box_new ();
625         gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE);
626         gtk_widget_set_size_request (event_box, BOX_WIDTH, BOX_HEIGHT);
627
628         gtk_container_add (GTK_CONTAINER (align), vbox);
629         gtk_container_add (GTK_CONTAINER (event_box), align);
630         gtk_container_add (GTK_CONTAINER (self), event_box);
631
632         g_signal_connect (event_box, "button-press-event",
633                 G_CALLBACK (button_press_event_cb), self);
634         g_signal_connect (event_box, "button-release-event",
635                 G_CALLBACK (button_release_event_cb), self);
636         g_signal_connect (event_box, "leave-notify-event",
637                 G_CALLBACK (leave_notify_event_cb), self);
638
639         gtk_widget_show_all (GTK_WIDGET (event_box));
640
641 #ifndef DEBUG_LAYOUT
642         priv->eventlogger = rtcom_el_new ();
643         g_signal_connect (priv->eventlogger,
644                           "new-event",
645                           G_CALLBACK (new_event_cb),
646                           self);
647         g_signal_connect (priv->eventlogger,
648                           "event-updated",
649                           G_CALLBACK (new_event_cb),
650                           self);
651
652         read_new_event (self);
653 #endif
654 }
655
656 static void
657 el_home_applet_class_init (ELHomeAppletClass *klass)
658 {
659         GObjectClass *object_class = G_OBJECT_CLASS (klass);
660         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
661
662         object_class->dispose = dispose;
663         object_class->finalize = finalize;
664         widget_class->expose_event = expose_event;
665         widget_class->realize = el_home_applet_realize;
666
667         g_type_class_add_private (klass, sizeof (ELHomeAppletPrivate));
668 }
669