2007-06-26 Murray Cumming <murrayc@murrayc.com>
[modest] / tests / dbus_api / test_get_folders.c
1 #include <libmodest-dbus-client/libmodest-dbus-client.h>
2 #include <stdio.h>
3
4
5 int main(int argc, char *argv[])
6 {
7         GSList *attachments = NULL;
8         /* Initialize maemo application */
9         osso_context_t * osso_context = osso_initialize(
10             "test_hello", "0.0.1", TRUE, NULL);
11                
12         /* Check that initialization was ok */
13         if (osso_context == NULL)
14         {
15                 printf("osso_initialize() failed.\n");
16             return OSSO_ERROR;
17         }
18         
19         /* Call the function in libmodest-dbus-client: */
20         
21         attachments = g_slist_append(attachments, "/usr/include/math.h,/usr/include/malloc.h");
22         
23         GList *list = NULL;
24         const gboolean ret = libmodest_dbus_client_get_folders (
25                 osso_context, &list);
26                 
27         if (!ret) {
28                 printf("libmodest_dbus_client_get_folders() failed.\n");
29                 return OSSO_ERROR;
30         } else {
31                 printf("libmodest_dbus_client_get_folders() succeeded\n");
32         }
33         
34         if (list) {
35                 GList *iter = NULL;
36                 for (iter = list; iter; iter = iter->next) {
37                         ModestFolderResult *item = (ModestFolderResult*)iter->data;     
38                         if (item) {
39                                 printf("  Folder name=%s\n", item->folder_name);
40                         }
41                 }
42         
43                 modest_folder_result_list_free (list);
44         } else {
45                 printf("  The list of folders was empty.\n");   
46         }       
47         
48     /* Exit */
49     return 0;
50 }