summaryrefslogtreecommitdiff
path: root/src/utils/erssd-config.c
blob: 1f89577f1b904f0a88fbbc5e33f4bd0e099f1512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
#include <Erssd.h>
#include <Elementary.h>

/* this is a VERY simple client for configurating eRSSd.
 * it is not meant to be a showcase of toolkits, merely an
 * example for how to use the erssd_util api.
 */

#define WEIGHT evas_object_size_hint_weight_set
#define ALIGN evas_object_size_hint_align_set
#define EXPAND(X) WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
#define FILL(X) ALIGN((X), EVAS_HINT_FILL, EVAS_HINT_FILL)

typedef struct Rss_Feed
{
   int conn;
   Eina_Stringshare *url;
   Eina_Stringshare *img_url;
   Eina_Binbuf *img_data;
   Azy_Rss *rss;
   Azy_Client *cli;
   Eina_Hash *read_items;
   Eina_Hash *unread_items;
   Elm_Object_Item *list_item;
} Rss_Feed;

static long dbus_view = 0;
static Eina_Stringshare *cachefile[2];
static Eet_File *ef_cache[2];
static Eina_Bool dbus_connected[2];

static Eina_Hash *feeds[2];

static Evas_Object *feed_list;
static Evas_Object *button_add, *button_del;
static Evas_Object *radios[2];

static Evas_Object *naviframe;
static Evas_Object *feed_item_list;

static Elm_Genlist_Item_Class feed_itc;
static Elm_Genlist_Item_Class feed_item_itc;

static void
_cache_refresh(int conn)
{
   if (ef_cache[conn]) eet_close(ef_cache[conn]);
   ef_cache[conn] = eet_open(cachefile[conn], EET_FILE_MODE_READ);
}

static void
_feed_selected_cb(void *data EINA_UNUSED /* Rss_Feed */, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   elm_object_disabled_set(button_del, 0);
}

static int
_sort_cb(Elm_Object_Item *a, Elm_Object_Item *b)
{
   Azy_Rss_Item *aa, *bb;

   aa = elm_object_item_data_get(a);
   bb = elm_object_item_data_get(b);

   if (azy_rss_item_pubdate_get(aa) > azy_rss_item_pubdate_get(bb))
     return -1;

   if (azy_rss_item_pubdate_get(aa) < azy_rss_item_pubdate_get(bb))
     return 1;

   return 0;
}

static void
_feed_activate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
   Elm_Object_Item *it = event_info;
   Rss_Feed *feed = elm_object_item_data_get(it);

   if (evas_object_data_get(feed_item_list, "feed") != feed)
     {
        Azy_Rss_Item *item;
        Eina_Iterator *iter;

        evas_object_data_set(feed_item_list, "feed", feed);
        elm_genlist_clear(feed_item_list);
        iter = eina_hash_iterator_data_new(feed->unread_items);
        EINA_ITERATOR_FOREACH(iter, item)
          elm_genlist_item_sorted_insert(feed_item_list, &feed_item_itc, item, NULL, 0, (Eina_Compare_Cb)_sort_cb, NULL, item);
        eina_iterator_free(iter);
     }
   elm_naviframe_item_push(naviframe, azy_rss_title_get(feed->rss), NULL, NULL, feed_item_list, NULL);
}

static Eina_Error
_feed_image_cb(Azy_Client *cli, Azy_Content *content, Eina_Binbuf *buf)
{
   Rss_Feed *feed;
   Azy_Net *net;
   Eina_Stringshare *content_type;

   feed = azy_client_data_get(cli);
   net = azy_content_net_get(content);
   content_type = azy_net_header_get(net, "content-type");
   if (content_type && (!strncmp(content_type, "image/", 6)))
     {
        size_t size = eina_binbuf_length_get(buf);
        feed->img_data = eina_binbuf_manage_new_length(eina_binbuf_string_steal(buf), size);
        if (feed->list_item)
          elm_genlist_item_fields_update(feed->list_item, "elm.swallow.icon", ELM_GENLIST_ITEM_FIELD_CONTENT);
     }
   azy_client_free(cli);
   feed->cli = NULL;
   return AZY_ERROR_NONE;
}

static void
_feed_update(Rss_Feed *feed, Eina_Bool refresh)
{
   azy_rss_free(feed->rss);
   feed->rss = erssd_util_eet_feed_get(ef_cache[feed->conn], feed->url);
   if (feed->rss)
     {
        if (eina_stringshare_replace(&feed->img_url, azy_rss_img_url_get(feed->rss)) && feed->img_url)
          {
             feed->cli = azy_client_util_connect(azy_rss_img_url_get(feed->rss));
             azy_client_callback_set(feed->cli, azy_client_current(feed->cli), (Azy_Client_Transfer_Complete_Cb)_feed_image_cb);
             azy_client_data_set(feed->cli, feed);
          }
     }
   if (feed->list_item && refresh) elm_genlist_item_update(feed->list_item);
}

static void
_feed_items_update(Rss_Feed *feed)
{
   Eina_List *l;
   Azy_Rss_Item *item;

   eina_hash_free_buckets(feed->read_items);
   eina_hash_free_buckets(feed->unread_items);
   l = erssd_util_eet_feed_read_get(ef_cache[feed->conn], feed->url);
   EINA_LIST_FREE(l, item)
     eina_hash_direct_add(feed->read_items, azy_rss_item_uuid_get(item), item);
   l = erssd_util_eet_feed_unread_get(ef_cache[feed->conn], feed->url);
   EINA_LIST_FREE(l, item)
     eina_hash_direct_add(feed->unread_items, azy_rss_item_uuid_get(item), item);
}

static Rss_Feed *
_feed_new(Eina_Stringshare *url, int conn)
{
   Rss_Feed *feed;

   feed = calloc(1, sizeof(Rss_Feed));
   feed->url = eina_stringshare_ref(url);
   feed->read_items = eina_hash_stringshared_new((Eina_Free_Cb)azy_rss_item_free);
   feed->unread_items = eina_hash_stringshared_new((Eina_Free_Cb)azy_rss_item_free);
   eina_hash_direct_add(feeds[conn], feed->url, feed);
   if (ef_cache[conn])
     {
        _feed_items_update(feed);
        _feed_update(feed, 0);
     }
   feed->list_item = elm_genlist_item_append(feed_list, &feed_itc, feed, NULL, 0, _feed_selected_cb, feed);
   feed->conn = conn;
   return feed;
}

static void
_feed_free(Rss_Feed *feed)
{
   if (!feed) return;
   //eina_stringshare_del(feed->url); already deleted
   eina_stringshare_del(feed->img_url);
   azy_rss_free(feed->rss);
   if (feed->list_item) elm_object_item_del(feed->list_item);
   if (feed->img_data) eina_binbuf_free(feed->img_data);
   eina_hash_free(feed->read_items);
   eina_hash_free(feed->unread_items);
   free(feed);
}

static char *
_it_feed_text_get(Azy_Rss_Item *item, Evas_Object *obj EINA_UNUSED, const char *part)
{
   Eina_Stringshare *title = NULL;

   if (!strcmp(part, "elm.text"))
     {
        title = azy_rss_item_title_get(item);
        return title ? strdup(title) : NULL;
     }
   title = azy_rss_item_desc_get(item);
   if (!title) title = azy_rss_item_content_get(item);
   return title ? strdup(title) : NULL;
}

static char *
_it_text_get(Rss_Feed *feed, Evas_Object *obj EINA_UNUSED, const char *part)
{
   Eina_Stringshare *title = NULL;
   char buf[4096];

   if (strcmp(part, "elm.text"))
     {
        if (!feed->rss) return NULL;
        title = azy_rss_desc_get(feed->rss);
        return title ? strdup(title) : NULL;
     }

   if (feed->rss)
     {
        title = azy_rss_title_get(feed->rss);
        snprintf(buf, sizeof(buf), "(%u unread) %s", eina_hash_population(feed->unread_items), title ?: feed->url);
     }
   else
     snprintf(buf, sizeof(buf), "%s", feed->url);

   return strdup(buf);
}

static Evas_Object *
_it_content_get(Rss_Feed *feed, Evas_Object *obj, const char *part EINA_UNUSED)
{
   Evas_Object *o;

   if ((!feed->img_data) && (!azy_rss_img_url_get(feed->rss))) return NULL;
   o = elm_image_add(obj);
   if (feed->img_data)
     elm_image_memfile_set(o, eina_binbuf_string_get(feed->img_data), eina_binbuf_length_get(feed->img_data), NULL, NULL);
   else
     elm_image_file_set(o, azy_rss_img_url_get(feed->rss), NULL);
   evas_object_show(o);
   return o;
}

static void
_it_del(Rss_Feed *feed, Evas_Object *obj EINA_UNUSED)
{
   feed->list_item = NULL;
}

static Eina_Bool
_feed_foreach_cb(const Eina_Hash *h EINA_UNUSED, const char *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
{
   //int conn = (long)fdata;
   Rss_Feed *feed = data;

   if (feed->list_item)
     elm_genlist_item_update(feed->list_item);
   else
     feed->list_item = elm_genlist_item_append(feed_list, &feed_itc, feed, NULL, 0, _feed_selected_cb, feed);
   return EINA_TRUE;
}

static void
_dbus_signal_feed_add(void *data, Eina_Stringshare *url)
{
   _cache_refresh((long)data);
   _feed_new(url, (long)data);
}

static void
_dbus_signal_feed_del(void *data, Eina_Stringshare *url)
{
   _cache_refresh((long)data);
   eina_hash_del_by_key(feeds[(long)data], url);
}

static void
_dbus_signal_feed_updated(void *data, Eina_Stringshare *url, unsigned int num)
{
   long conn = (long)data;
   Rss_Feed *feed;

   feed = eina_hash_find(feeds[conn], url);
   if (!feed)
     {
        fprintf(stderr, EINA_COLOR_RED "%s not one of our feeds!\n" EINA_COLOR_RESET, url);
        return;
     }
   _cache_refresh((long)data);
   _feed_update(feed, !!num);
   if (num) _feed_items_update(feed);
}

static void
_dbus_view_change(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   /* FIXME: probably want to keep both lists in a naviframe or something */
   elm_genlist_clear(feed_list);
   elm_object_disabled_set(button_del, 1);
   if (feeds[dbus_view])
     eina_hash_foreach(feeds[dbus_view], (Eina_Hash_Foreach)_feed_foreach_cb, (void*)dbus_view);
}

static void
_dbus_feeds_list_cb(void *data, const Eina_List *ret)
{
   int conn = (long)data;
   const Eina_List *l;
   Eina_Stringshare *url;

   if (feeds[conn]) return;
   feeds[conn] = eina_hash_string_superfast_new((Eina_Free_Cb)_feed_free);
   EINA_LIST_FOREACH(ret, l, url)
     _feed_new(url, conn);
}

static void
_list_update(void)
{
   if (feeds[dbus_view])
     eina_hash_foreach(feeds[dbus_view], (Eina_Hash_Foreach)_feed_foreach_cb, (void*)dbus_view);
   else
     erssd_util_feeds_list(dbus_view, _dbus_feeds_list_cb, (void*)dbus_view);
}

static void
_dbus_cachefile_cb(void *data, Eina_Stringshare *cfile)
{
   int conn = (long)data;
   eina_stringshare_replace(&cachefile[conn], cfile);
   _cache_refresh(conn);
   if (dbus_view == conn) _list_update();
}

static void
_dbus_nameowner_cb(void *data, Eina_Bool nameowned)
{
   int conn = (long)data;
   dbus_connected[conn] = nameowned;
   if (dbus_connected[conn])
     {
        if (!ef_cache[conn])
          erssd_util_feed_cachefile_get(conn, _dbus_cachefile_cb, data);
     }
   else
     {
        if (ef_cache[conn])
          eet_close(ef_cache[conn]);
        ef_cache[conn] = NULL;
     }
   if (!dbus_connected[dbus_view])
     {
        elm_genlist_clear(feed_list);
        elm_object_disabled_set(button_del, 1);
        /* FIXME: overlay fade or something */
     }
}

static void
_add_feed_close_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
   elm_object_disabled_set(feed_list, 0);
   elm_object_disabled_set(button_add, 0);
   elm_object_disabled_set(button_del, !elm_genlist_selected_item_get(feed_list));
   elm_object_disabled_set(radios[0], 0);
   elm_object_disabled_set(radios[1], 0);
   evas_object_del(obj);
}

static void
_add_feed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
   /* FIXME: should probably check return here */
   erssd_util_feed_add(dbus_view, elm_entry_entry_get(obj), NULL, NULL);
   elm_ctxpopup_dismiss(data);
}

static void
_add_feed_key_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
   Evas_Event_Key_Down *ev = event_info;

   if (!strcmp(ev->keyname, "Escape")) elm_ctxpopup_dismiss(data);
}

static void
_add_feed(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
   Evas_Object *ctx, *entry, *box, *win;
   int x, y, w, h;

   win = elm_object_top_widget_get(obj);

   evas_object_geometry_get(win, NULL, NULL, &w, &h);
   box = elm_box_add(win);
   edje_extern_object_min_size_set(box, 50, 24);
   EXPAND(box);
   FILL(box);

   entry = elm_entry_add(win);
   elm_entry_line_wrap_set(entry, ELM_WRAP_MIXED);
   elm_entry_single_line_set(entry, 1);
   elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
   EXPAND(entry);
   FILL(entry);
   elm_box_pack_end(box, entry);
   evas_object_show(entry);

   evas_object_show(box);

   ctx = elm_ctxpopup_add(win);
   evas_object_smart_callback_add(ctx, "dismissed", _add_feed_close_cb, NULL);
   elm_object_content_set(ctx, box);
   evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
   evas_object_show(ctx);
   evas_object_move(ctx, x, y);

   evas_object_smart_callback_add(entry, "activated", _add_feed_cb, ctx);
   evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, _add_feed_key_cb, ctx);

   elm_object_disabled_set(feed_list, 1);
   elm_object_disabled_set(button_add, 1);
   elm_object_disabled_set(button_del, 1);
   elm_object_disabled_set(radios[0], 1);
   elm_object_disabled_set(radios[1], 1);
   elm_object_focus_set(entry, 1);
}

static void
_del_feed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   Elm_Object_Item *it;
   Rss_Feed *feed;

   it = elm_genlist_selected_item_get(feed_list);
   if (!it) return; //should be impossible here
   feed = elm_object_item_data_get(it);
   erssd_util_feed_del(dbus_view, feed->url, NULL, NULL);
   elm_object_disabled_set(button_del, 1);
}

static void
_quit_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   ecore_main_loop_quit();
}

int
main(int argc, char *argv[])
{
   Evas_Object *win, *grp, *hbox, *vbox, *o;

   EINA_SAFETY_ON_TRUE_RETURN_VAL(!erssd_util_init(), 1);
   elm_init(argc, argv);

   erssd_util_nameowner_cb_set(0, (Erssd_Util_Data_Cb)_dbus_nameowner_cb, NULL);
   erssd_util_nameowner_cb_set(1, (Erssd_Util_Data_Cb)_dbus_nameowner_cb, (void*)1);
   
   win = elm_win_util_standard_add("erssd-config", "eRSSd Configuration");
   evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, (Evas_Object_Event_Cb)_quit_cb, NULL);
   elm_win_center(win, 1, 1);
   elm_win_autodel_set(win, 1);

   o = elm_bg_add(win);
   EXPAND(o);
   FILL(o);
   elm_bg_color_set(o, 0, 0, 0);
   elm_win_resize_object_add(win, o);
   evas_object_show(o);

   naviframe = o = elm_naviframe_add(win);
   elm_object_style_set(o, "slide");
   EXPAND(o);
   FILL(o);
   elm_naviframe_content_preserve_on_pop_set(o, 1);
   elm_win_resize_object_add(win, o);
   evas_object_show(o);

   vbox = elm_box_add(win);
   elm_naviframe_item_simple_push(naviframe, vbox);
   EXPAND(vbox);
   FILL(vbox);

   hbox = elm_box_add(win);
   elm_box_horizontal_set(hbox, 1);
   elm_box_homogeneous_set(hbox, 1);
   WEIGHT(hbox, EVAS_HINT_EXPAND, 0);
   FILL(vbox);

   radios[0] = grp = elm_radio_add(win);
   evas_object_smart_callback_add(grp, "changed", _dbus_view_change, NULL);
   elm_box_pack_end(hbox, grp);
   elm_object_text_set(grp, "Session");
   elm_radio_state_value_set(grp, 0);
   elm_radio_value_pointer_set(grp, (int*)&dbus_view);
   evas_object_show(grp);

   radios[1] = o = elm_radio_add(win);
   evas_object_smart_callback_add(o, "changed", _dbus_view_change, NULL);
   elm_box_pack_end(hbox, o);
   elm_radio_group_add(o, grp);
   elm_object_text_set(o, "System");
   elm_radio_state_value_set(o, 1);
   evas_object_show(o);

   evas_object_show(hbox);
   elm_box_pack_end(vbox, hbox);

   feed_list = o = elm_genlist_add(win);
   EXPAND(o);
   FILL(o);
   elm_scroller_bounce_set(o, EINA_FALSE, EINA_FALSE);
   elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
   elm_genlist_mode_set(o, ELM_LIST_COMPRESS);
   evas_object_smart_callback_add(o, "activated", _feed_activate, NULL);
   evas_object_show(o);
   elm_box_pack_end(vbox, o);

   hbox = elm_box_add(win);
   elm_box_pack_end(vbox, hbox);
   elm_box_horizontal_set(hbox, 1);
   elm_box_homogeneous_set(hbox, 1);

   button_add = o = elm_button_add(win);
   WEIGHT(o, 0, 0);
   FILL(o);
   elm_box_pack_end(hbox, o);
   elm_object_text_set(o, "Add Feed");
   evas_object_smart_callback_add(o, "clicked", _add_feed, NULL);
   evas_object_show(o);
   /*
   o = elm_icon_add(win);
   elm_icon_standard_set(o, "bookmark-new"); //FIXME: should be a specific rss icon
   elm_object_part_content_set(button_add, "icon", o);
   evas_object_show(o);
   */

   button_del = o = elm_button_add(win);
   WEIGHT(o, 0, 0);
   FILL(o);
   elm_box_pack_end(hbox, o);
   elm_object_text_set(o, "Remove Feed");
   elm_object_disabled_set(o, 1);
   evas_object_smart_callback_add(o, "clicked", _del_feed, NULL);
   evas_object_show(o);
   /*
   o = elm_icon_add(win);
   elm_icon_standard_set(o, "list-remove"); //FIXME: should be a specific rss icon
   elm_object_part_content_set(button_del, "icon", o);
   evas_object_show(o);
   */

   feed_item_list = o = elm_genlist_add(win);
   EXPAND(o);
   FILL(o);
   elm_scroller_bounce_set(o, EINA_FALSE, EINA_FALSE);
   elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
   elm_genlist_mode_set(o, ELM_LIST_COMPRESS);
   evas_object_show(o);

   evas_object_show(hbox);
   
   evas_object_show(vbox);

   evas_object_show(win);

   feed_itc.item_style = "double_label";
   feed_itc.func.text_get = (Elm_Genlist_Item_Text_Get_Cb)_it_text_get;
   feed_itc.func.content_get = (Elm_Genlist_Item_Content_Get_Cb)_it_content_get;
   feed_itc.func.del = (Elm_Genlist_Item_Del_Cb)_it_del;
   feed_itc.version = ELM_GENLIST_ITEM_CLASS_VERSION;

   feed_item_itc.item_style = "double_label";
   feed_item_itc.func.text_get = (Elm_Genlist_Item_Text_Get_Cb)_it_feed_text_get;
   feed_item_itc.version = ELM_GENLIST_ITEM_CLASS_VERSION;

   erssd_util_feed_signal_cb_set(0, ERSSD_SIGNAL_FEED_UPDATED, _dbus_signal_feed_updated, NULL);
   erssd_util_feed_signal_cb_set(1, ERSSD_SIGNAL_FEED_UPDATED, _dbus_signal_feed_updated, (void*)1);

   erssd_util_feed_signal_cb_set(0, ERSSD_SIGNAL_FEED_ADD, _dbus_signal_feed_add, NULL);
   erssd_util_feed_signal_cb_set(1, ERSSD_SIGNAL_FEED_ADD, _dbus_signal_feed_add, (void*)1);

   erssd_util_feed_signal_cb_set(0, ERSSD_SIGNAL_FEED_DEL, _dbus_signal_feed_del, NULL);
   erssd_util_feed_signal_cb_set(1, ERSSD_SIGNAL_FEED_DEL, _dbus_signal_feed_del, (void*)1);

   elm_win_size_base_set(win, 320, 240);
   evas_object_resize(win, 320, 240);

   ecore_main_loop_begin();
   eina_hash_free(feeds[0]);
   eina_hash_free(feeds[1]);
   return 0;
}