3 * Authors (alphabetical) :
4 * mrmoku (Klaus Kurzmann, mok@fluxnetz.de)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Public License as published by
8 * the Free Software Foundation; version 2 of the license.
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 Lesser Public License for more details.
20 #include <dbus/dbus-glib.h>
21 #include <dbus/dbus-glib-bindings.h>
22 #include "frameworkd-glib-opimd-messages.h"
23 #include "frameworkd-glib-opimd-dbus.h"
24 #include "dbus/messages.h"
27 DBusGProxy
*opimdMessagesBus
= NULL
;
29 /* === PIM.Messages Interface ====================================================== */
31 /* --- Add ------------------------------------------------------------------------- */
34 void (*callback
) (GError
*, char *, gpointer
);
36 } opimd_messages_add_data_t
;
39 opimd_messages_add_callback(DBusGProxy
* proxy
, char *message_path
,
40 GError
* dbus_error
, gpointer userdata
)
43 opimd_messages_add_data_t
*data
= userdata
;
46 if (data
->callback
!= NULL
) {
47 if (dbus_error
!= NULL
)
48 error
= dbus_handle_errors(dbus_error
);
49 data
->callback(error
, message_path
, data
->userdata
);
53 if (dbus_error
!= NULL
)
54 g_error_free(dbus_error
);
60 opimd_messages_add(const GHashTable
* message_data
,
61 void (*callback
) (GError
*, char *, gpointer
),
64 dbus_connect_to_opimd_messages();
65 opimd_messages_add_data_t
*data
=
66 g_malloc(sizeof(opimd_messages_add_data_t
));
67 data
->callback
= callback
;
68 data
->userdata
= userdata
;
69 org_freesmartphone_PIM_Messages_add_async(opimdMessagesBus
,
71 opimd_messages_add_callback
,
76 /* --- GetSingleEntrySingleField ------------------------------------------------- */
79 void (*callback
) (GError
*, char *, gpointer
);
81 } opimd_messages_get_single_entry_single_field_data_t
;
84 opimd_messages_get_single_entry_single_field_callback(DBusGProxy
* bus
,
90 opimd_messages_get_single_entry_single_field_data_t
*data
= userdata
;
93 if (data
->callback
!= NULL
) {
94 if (dbus_error
!= NULL
)
95 error
= dbus_handle_errors(dbus_error
);
97 data
->callback(error
, value
, data
->userdata
);
101 if (dbus_error
!= NULL
)
102 g_error_free(dbus_error
);
108 opimd_messages_get_single_entry_single_field(const GHashTable
* query
,
110 void (*callback
) (GError
*, char *,
114 dbus_connect_to_opimd_messages();
115 opimd_messages_get_single_entry_single_field_data_t
*data
=
117 (opimd_messages_get_single_entry_single_field_data_t
));
118 data
->callback
= callback
;
119 data
->userdata
= userdata
;
120 org_freesmartphone_PIM_Messages_get_single_entry_single_field_async
121 (opimdMessagesBus
, query
, field
,
122 opimd_messages_get_single_entry_single_field_callback
, data
);
126 /* --- Query ----------------------------------------------------------------------- */
129 void (*callback
) (GError
*, char *, gpointer
);
131 } opimd_messages_query_data_t
;
134 opimd_messages_query_callback(DBusGProxy
* proxy
, char *query_path
,
135 GError
* dbus_error
, gpointer userdata
)
138 opimd_messages_query_data_t
*data
= userdata
;
139 GError
*error
= NULL
;
141 if (data
->callback
!= NULL
) {
142 if (dbus_error
!= NULL
)
143 error
= dbus_handle_errors(dbus_error
);
144 data
->callback(error
, query_path
, data
->userdata
);
148 if (dbus_error
!= NULL
)
149 g_error_free(dbus_error
);
155 opimd_messages_query(const GHashTable
* query
,
156 void (*callback
) (GError
*, char *, gpointer
),
159 dbus_connect_to_opimd_messages();
160 opimd_messages_query_data_t
*data
=
161 g_malloc(sizeof(opimd_messages_query_data_t
));
162 data
->callback
= callback
;
163 data
->userdata
= userdata
;
164 org_freesmartphone_PIM_Messages_query_async(opimdMessagesBus
, query
,
165 opimd_messages_query_callback
,
170 /* --- GetFolderNames -------------------------------------------------------------- */
173 void (*callback
) (GError
*, char **, gpointer
);
175 } opimd_messages_get_folder_names_data_t
;
178 opimd_messages_get_folder_names_callback(DBusGProxy
* proxy
,
180 GError
* dbus_error
, gpointer userdata
)
183 opimd_messages_get_folder_names_data_t
*data
= userdata
;
184 GError
*error
= NULL
;
186 if (data
->callback
!= NULL
) {
187 if (dbus_error
!= NULL
)
188 error
= dbus_handle_errors(dbus_error
);
189 data
->callback(error
, folder_names
, data
->userdata
);
193 if (dbus_error
!= NULL
)
194 g_error_free(dbus_error
);
200 opimd_messages_get_folder_names(void (*callback
) (GError
*, char **, gpointer
),
203 dbus_connect_to_opimd_messages();
204 opimd_messages_get_folder_names_data_t
*data
=
205 g_malloc(sizeof(opimd_messages_get_folder_names_data_t
));
206 data
->callback
= callback
;
207 data
->userdata
= userdata
;
208 org_freesmartphone_PIM_Messages_get_folder_names_async(opimdMessagesBus
,
209 opimd_messages_get_folder_names_callback
,
214 /* --- GetFolderURIFromName -------------------------------------------------------- */
217 void (*callback
) (GError
*, char *, gpointer
);
219 } opimd_messages_get_folder_path_from_name_data_t
;
222 opimd_messages_get_folder_path_from_name_callback(DBusGProxy
* proxy
,
228 opimd_messages_get_folder_path_from_name_data_t
*data
= userdata
;
229 GError
*error
= NULL
;
231 if (data
->callback
!= NULL
) {
232 if (dbus_error
!= NULL
)
233 error
= dbus_handle_errors(dbus_error
);
234 data
->callback(error
, folder_path
, data
->userdata
);
238 if (dbus_error
!= NULL
)
239 g_error_free(dbus_error
);
245 opimd_messages_get_folder_path_from_name(const char *folder_name
,
246 void (*callback
) (GError
*, char *,
250 dbus_connect_to_opimd_messages();
251 opimd_messages_get_folder_path_from_name_data_t
*data
=
253 (opimd_messages_get_folder_path_from_name_data_t
));
254 data
->callback
= callback
;
255 data
->userdata
= userdata
;
256 org_freesmartphone_PIM_Messages_get_folder_path_from_name_async
257 (opimdMessagesBus
, folder_name
,
258 opimd_messages_get_folder_path_from_name_callback
, data
);
262 /* --- GetUnreadMessages ----------------------------------------------------------- */
265 void (*callback
)(GError
*, const int, gpointer
);
267 } opimd_messages_get_unread_messages_data_t
;
270 opimd_messages_get_unread_messages_callback(DBusGProxy
*proxy
,
271 const int amount
, GError
*dbus_error
, gpointer userdata
)
274 opimd_messages_get_unread_messages_data_t
*data
= userdata
;
275 GError
*error
= NULL
;
277 if (data
->callback
!= NULL
) {
278 if (dbus_error
!= NULL
)
279 error
= dbus_handle_errors(dbus_error
);
280 data
->callback(error
, amount
, data
->userdata
);
284 if (dbus_error
!= NULL
)
285 g_error_free(dbus_error
);
291 opimd_messages_get_unread_messages(
292 void (*callback
) (GError
*, const int, gpointer
),
295 dbus_connect_to_opimd_messages();
296 opimd_messages_get_unread_messages_data_t
*data
=
298 (opimd_messages_get_unread_messages_data_t
));
299 data
->callback
= callback
;
300 data
->userdata
= userdata
;
301 org_freesmartphone_PIM_Messages_get_unread_messages_async
303 opimd_messages_get_unread_messages_callback
, data
);
306 /* --- (signal) NewMessage --------------------------------------------------------- */
309 opimd_messages_new_message_handler(DBusGProxy
* proxy
, const char *message_path
,
313 void (*callback
) (const char *) = NULL
;
317 if (callback
!= NULL
)
318 (*callback
) (message_path
);
322 /* --- (signal) IncomingMessage ---------------------------------------------------- */
325 opimd_messages_incoming_message_handler(DBusGProxy
* proxy
, const char *message_path
,
329 void (*callback
) (const char *) = NULL
;
333 if (callback
!= NULL
)
334 (*callback
) (message_path
);
338 /* --- (signal) UnreadMessages -------------------------------------------------- */
341 opimd_messages_unread_messages_handler(DBusGProxy
*proxy
,
342 int amount
, gpointer userdata
)
345 void (*callback
) (int) = NULL
;
349 if (callback
!= NULL
)
350 (*callback
) (amount
);
354 /* --- (signal) UpdatedMessage -------------------------------------------------- */
357 opimd_messages_updated_message_handler(DBusGProxy
*proxy
,
358 const char *message_path
, GHashTable
*message_data
,
362 void (*callback
) (const char *, GHashTable
*) = NULL
;
366 if (callback
!= NULL
)
367 (*callback
) (message_path
, message_data
);
371 /* --- (signal) DeletedMessage -------------------------------------------------- */
374 opimd_messages_deleted_message_handler(DBusGProxy
*proxy
,
375 const char *message_path
, gpointer userdata
)
378 void (*callback
) (const char *) = NULL
;
382 if (callback
!= NULL
)
383 (*callback
) (message_path
);
388 /* === PIM.Message Interface ======================================================= */
390 /* --- GetContent ------------------------------------------------------------------ */
393 void (*callback
) (GError
*, GHashTable
*, gpointer
);
395 } opimd_message_get_content_data_t
;
398 opimd_message_get_content_callback(DBusGProxy
* proxy
, GHashTable
* content
,
399 GError
* dbus_error
, gpointer userdata
)
402 opimd_message_get_content_data_t
*data
= userdata
;
403 GError
*error
= NULL
;
405 if (data
->callback
!= NULL
) {
406 if (dbus_error
!= NULL
)
407 error
= dbus_handle_errors(dbus_error
);
408 data
->callback(error
, content
, data
->userdata
);
412 if (dbus_error
!= NULL
)
413 g_error_free(dbus_error
);
419 opimd_message_get_content(const char *message_path
,
420 void (*callback
) (GError
*, GHashTable
*, gpointer
),
423 DBusGProxy
*proxy
= dbus_connect_to_opimd_message(message_path
);
424 opimd_message_get_content_data_t
*data
=
425 g_malloc(sizeof(opimd_message_get_content_data_t
));
426 data
->callback
= callback
;
427 data
->userdata
= userdata
;
428 org_freesmartphone_PIM_Message_get_content_async(proxy
,
429 opimd_message_get_content_callback
,
434 /* --- GetMultipleFields ----------------------------------------------------------- */
437 void (*callback
) (GError
*, GHashTable
*, gpointer
);
439 } opimd_message_get_multiple_fields_data_t
;
442 opimd_message_get_multiple_fields_callback(DBusGProxy
* proxy
,
443 GHashTable
* field_data
,
448 opimd_message_get_multiple_fields_data_t
*data
= userdata
;
449 GError
*error
= NULL
;
451 if (data
->callback
!= NULL
) {
452 if (dbus_error
!= NULL
)
453 error
= dbus_handle_errors(dbus_error
);
454 data
->callback(error
, field_data
, userdata
);
458 if (dbus_error
!= NULL
)
459 g_error_free(dbus_error
);
465 opimd_message_get_multiple_fields(const char *message_path
, const char *fields
,
466 void (*callback
) (GError
*, GHashTable
*,
470 DBusGProxy
*proxy
= dbus_connect_to_opimd_message(message_path
);
471 opimd_message_get_multiple_fields_data_t
*data
=
472 g_malloc(sizeof(opimd_message_get_multiple_fields_data_t
));
473 data
->callback
= callback
;
474 data
->userdata
= userdata
;
475 org_freesmartphone_PIM_Message_get_multiple_fields_async(proxy
, fields
,
476 opimd_message_get_multiple_fields_callback
,
481 /* --- MoveToFolder ---------------------------------------------------------------- */
484 void (*callback
) (GError
*, gpointer
);
486 } opimd_message_move_to_folder_data_t
;
489 opimd_message_move_to_folder_callback(DBusGProxy
* proxy
, GError
* dbus_error
,
493 opimd_message_move_to_folder_data_t
*data
= userdata
;
494 GError
*error
= NULL
;
496 if (data
->callback
!= NULL
) {
497 if (dbus_error
!= NULL
)
498 error
= dbus_handle_errors(dbus_error
);
499 data
->callback(error
, data
->userdata
);
503 if (dbus_error
!= NULL
)
504 g_error_free(dbus_error
);
510 opimd_message_move_to_folder(const char *message_path
, const char *folder
,
511 void (*callback
) (GError
*, gpointer
),
514 DBusGProxy
*proxy
= dbus_connect_to_opimd_message(message_path
);
515 opimd_message_move_to_folder_data_t
*data
=
516 g_malloc(sizeof(opimd_message_move_to_folder_data_t
));
517 data
->callback
= callback
;
518 data
->userdata
= userdata
;
519 org_freesmartphone_PIM_Message_move_to_folder_async(proxy
, folder
,
520 opimd_message_move_to_folder_callback
,
525 /* --- Update ---------------------------------------------------------------------- */
528 void (*callback
) (GError
*, gpointer
);
530 } opimd_message_update_data_t
;
532 void opimd_message_update_callback(DBusGProxy
*proxy
, GError
*dbus_error
,
536 opimd_message_update_data_t
*data
= userdata
;
537 GError
*error
= NULL
;
539 if (data
->callback
!= NULL
) {
540 if (dbus_error
!= NULL
)
541 error
= dbus_handle_errors(dbus_error
);
542 data
->callback(error
, data
->userdata
);
548 g_error_free(dbus_error
);
554 opimd_message_update(const char *message_path
, GHashTable
*field_data
,
555 void (*callback
)(GError
*, gpointer
), gpointer userdata
)
557 DBusGProxy
*proxy
= dbus_connect_to_opimd_message(message_path
);
558 opimd_message_update_data_t
*data
=
559 g_malloc(sizeof(opimd_message_update_data_t
));
560 data
->callback
= callback
;
561 data
->userdata
= userdata
;
562 org_freesmartphone_PIM_Message_update_async(proxy
, field_data
,
563 opimd_message_update_callback
,
568 /* --- Delete ---------------------------------------------------------------------- */
571 void (*callback
) (GError
*, gpointer
);
573 } opimd_message_delete_data_t
;
577 opimd_message_delete_callback(DBusGProxy
* proxy
, GError
* dbus_error
,
581 opimd_message_delete_data_t
*data
= userdata
;
582 GError
*error
= NULL
;
584 if (data
->callback
!= NULL
) {
585 if (dbus_error
!= NULL
)
586 error
= dbus_handle_errors(dbus_error
);
587 data
->callback(error
, data
->userdata
);
593 g_error_free(dbus_error
);
600 opimd_message_delete(const char *message_path
,
601 void (*callback
) (GError
*, gpointer
), gpointer userdata
)
603 DBusGProxy
*proxy
= dbus_connect_to_opimd_message(message_path
);
604 opimd_message_delete_data_t
*data
=
605 g_malloc(sizeof(opimd_message_delete_data_t
));
606 data
->callback
= callback
;
607 data
->userdata
= userdata
;
608 org_freesmartphone_PIM_Message_delete_async(proxy
,
609 opimd_message_delete_callback
,
615 /* === PIM.MessageQuery Interface ================================================== */
617 /* --- GetResultCount -------------------------------------------------------------- */
620 void (*callback
) (GError
*, gint
, gpointer
);
622 } opimd_message_query_get_result_count_data_t
;
625 opimd_message_query_get_result_count_callback(DBusGProxy
* proxy
, int count
,
630 opimd_message_query_get_result_count_data_t
*data
= userdata
;
631 GError
*error
= NULL
;
633 if (data
->callback
!= NULL
) {
634 if (dbus_error
!= NULL
)
635 error
= dbus_handle_errors(dbus_error
);
636 data
->callback(error
, count
, data
->userdata
);
640 if (dbus_error
!= NULL
)
641 g_error_free(dbus_error
);
647 opimd_message_query_get_result_count(DBusGProxy
* query
,
648 void (*callback
) (GError
*, gint
,
652 opimd_message_query_get_result_count_data_t
*data
=
653 g_malloc(sizeof(opimd_message_query_get_result_count_data_t
));
654 data
->callback
= callback
;
655 data
->userdata
= userdata
;
656 org_freesmartphone_PIM_MessageQuery_get_result_count_async(query
,
657 opimd_message_query_get_result_count_callback
,
662 /* --- Rewind ---------------------------------------------------------------------- */
665 void (*callback
) (GError
*, gpointer
);
667 } opimd_message_query_rewind_data_t
;
670 opimd_message_query_rewind_callback(DBusGProxy
* proxy
, GError
* dbus_error
,
674 opimd_message_query_rewind_data_t
*data
= userdata
;
675 GError
*error
= NULL
;
677 if (data
->callback
!= NULL
) {
678 if (dbus_error
!= NULL
)
679 error
= dbus_handle_errors(dbus_error
);
680 data
->callback(error
, data
->userdata
);
684 if (dbus_error
!= NULL
)
685 g_error_free(dbus_error
);
691 opimd_message_query_rewind(DBusGProxy
* query
,
692 void (*callback
) (GError
*, gpointer
),
695 opimd_message_query_rewind_data_t
*data
=
696 g_malloc(sizeof(opimd_message_query_rewind_data_t
));
697 data
->callback
= callback
;
698 data
->userdata
= userdata
;
699 org_freesmartphone_PIM_MessageQuery_rewind_async(query
,
700 opimd_message_query_rewind_callback
,
705 /* --- Skip ------------------------------------------------------------------------ */
708 void (*callback
) (GError
*, gpointer
);
710 } opimd_message_query_skip_data_t
;
713 opimd_message_query_skip_callback(DBusGProxy
* proxy
, GError
* dbus_error
,
717 opimd_message_query_skip_data_t
*data
= userdata
;
718 GError
*error
= NULL
;
720 if (data
->callback
!= NULL
) {
721 if (dbus_error
!= NULL
)
722 error
= dbus_handle_errors(dbus_error
);
723 data
->callback(error
, data
->userdata
);
727 if (dbus_error
!= NULL
)
728 g_error_free(dbus_error
);
734 opimd_message_query_skip(DBusGProxy
* query
, const gint count
,
735 void (*callback
) (GError
*, gpointer
),
738 opimd_message_query_skip_data_t
*data
=
739 g_malloc(sizeof(opimd_message_query_skip_data_t
));
740 data
->callback
= callback
;
741 data
->userdata
= userdata
;
742 org_freesmartphone_PIM_MessageQuery_skip_async(query
, count
,
743 opimd_message_query_skip_callback
,
748 /* --- GetMessagePath -------------------------------------------------------------- */
751 void (*callback
) (GError
*, char *, gpointer
);
753 } opimd_message_query_get_message_path_data_t
;
756 opimd_message_query_get_message_path_callback(DBusGProxy
* proxy
,
762 opimd_message_query_get_message_path_data_t
*data
= userdata
;
763 GError
*error
= NULL
;
765 if (data
->callback
!= NULL
) {
766 if (dbus_error
!= NULL
)
767 error
= dbus_handle_errors(dbus_error
);
768 data
->callback(error
, message_path
, data
->userdata
);
772 if (dbus_error
!= NULL
)
773 g_error_free(dbus_error
);
779 opimd_message_query_get_message_path(DBusGProxy
* query
,
780 void (*callback
) (GError
*, char *,
784 opimd_message_query_get_message_path_data_t
*data
=
785 g_malloc(sizeof(opimd_message_query_get_message_path_data_t
));
786 data
->callback
= callback
;
787 data
->userdata
= userdata
;
788 org_freesmartphone_PIM_MessageQuery_get_message_path_async(query
,
789 opimd_message_query_get_message_path_callback
,
794 /* --- GetResult ------------------------------------------------------------------- */
797 void (*callback
) (GError
*, GHashTable
*, gpointer
);
799 } opimd_message_query_get_result_data_t
;
802 opimd_message_query_get_result_callback(DBusGProxy
* proxy
, GHashTable
* result
,
803 GError
* dbus_error
, gpointer userdata
)
806 opimd_message_query_get_result_data_t
*data
= userdata
;
807 GError
*error
= NULL
;
809 if (data
->callback
!= NULL
) {
810 if (dbus_error
!= NULL
)
811 error
= dbus_handle_errors(dbus_error
);
812 data
->callback(error
, result
, data
->userdata
);
816 if (dbus_error
!= NULL
)
817 g_error_free(dbus_error
);
823 opimd_message_query_get_result(DBusGProxy
* query
,
824 void (*callback
) (GError
*, GHashTable
* result
,
825 gpointer
), gpointer userdata
)
827 opimd_message_query_get_result_data_t
*data
=
828 g_malloc(sizeof(opimd_message_query_get_result_data_t
));
829 data
->callback
= callback
;
830 data
->userdata
= userdata
;
831 org_freesmartphone_PIM_MessageQuery_get_result_async(query
,
832 opimd_message_query_get_result_callback
,
837 /* --- GetMultipleResults ---------------------------------------------------------- */
840 void (*callback
) (GError
*, GPtrArray
*, gpointer
);
842 } opimd_message_query_get_multiple_results_data_t
;
845 opimd_message_query_get_multiple_results_callback(DBusGProxy
* proxy
,
846 GPtrArray
* resultset
,
851 opimd_message_query_get_multiple_results_data_t
*data
= userdata
;
852 GError
*error
= NULL
;
854 if (data
->callback
!= NULL
) {
855 if (dbus_error
!= NULL
)
856 error
= dbus_handle_errors(dbus_error
);
857 data
->callback(error
, resultset
, data
->userdata
);
861 if (dbus_error
!= NULL
)
862 g_error_free(dbus_error
);
868 opimd_message_query_get_multiple_results(DBusGProxy
* query
, int count
,
869 void (*callback
) (GError
*,
874 opimd_message_query_get_multiple_results_data_t
*data
=
876 (opimd_message_query_get_multiple_results_data_t
));
877 data
->callback
= callback
;
878 data
->userdata
= userdata
;
879 org_freesmartphone_PIM_MessageQuery_get_multiple_results_async(query
,
881 opimd_message_query_get_multiple_results_callback
,
887 /* --- Dispose --------------------------------------------------------------------- */
890 void (*callback
) (GError
*, gpointer
);
892 } opimd_message_query_dispose_data_t
;
895 opimd_message_query_dispose_callback(DBusGProxy
* proxy
, GError
* dbus_error
,
899 opimd_message_query_dispose_data_t
*data
= userdata
;
900 GError
*error
= NULL
;
902 if (data
->callback
!= NULL
) {
903 if (dbus_error
!= NULL
)
904 error
= dbus_handle_errors(dbus_error
);
905 data
->callback(error
, data
->userdata
);
909 if (dbus_error
!= NULL
)
910 g_error_free(dbus_error
);
916 opimd_message_query_dispose(DBusGProxy
* query
,
917 void (*callback
) (GError
*, gpointer
),
920 opimd_message_query_dispose_data_t
*data
=
921 g_malloc(sizeof(opimd_message_query_dispose_data_t
));
922 data
->callback
= callback
;
923 data
->userdata
= userdata
;
924 org_freesmartphone_PIM_MessageQuery_dispose_async(query
,
925 opimd_message_query_dispose_callback
,
930 /* === PIM.MessageFolder Interface ================================================= */
932 /* --- GetMessageCount ------------------------------------------------------------- */
935 void (*callback
) (GError
*, gint
, gpointer
);
937 } opimd_message_folder_get_message_count_data_t
;
940 opimd_message_folder_get_message_count_callback(DBusGProxy
* proxy
, gint count
,
945 opimd_message_folder_get_message_count_data_t
*data
= userdata
;
946 GError
*error
= NULL
;
948 if (data
->callback
!= NULL
) {
949 if (dbus_error
!= NULL
)
950 error
= dbus_handle_errors(dbus_error
);
951 data
->callback(error
, count
, data
->userdata
);
955 if (dbus_error
!= NULL
)
956 g_error_free(dbus_error
);
962 opimd_message_folder_get_message_count(const char *folder_path
,
963 void (*callback
) (GError
*, gint
,
967 DBusGProxy
*proxy
= dbus_connect_to_opimd_message_folder(folder_path
);
968 opimd_message_folder_get_message_count_data_t
*data
=
969 g_malloc(sizeof(opimd_message_folder_get_message_count_data_t
));
970 data
->callback
= callback
;
971 data
->userdata
= userdata
;
972 org_freesmartphone_PIM_MessageFolder_get_message_count_async(proxy
,
973 opimd_message_folder_get_message_count_callback
,
978 /* --- GetMessagePaths ------------------------------------------------------------- */
981 void (*callback
) (GError
*, char **, gpointer
);
983 } opimd_message_folder_get_message_paths_data_t
;
986 opimd_message_folder_get_message_paths_callback(DBusGProxy
* proxy
,
987 char **message_paths
,
992 opimd_message_folder_get_message_paths_data_t
*data
= userdata
;
993 GError
*error
= NULL
;
995 if (data
->callback
!= NULL
) {
996 if (dbus_error
!= NULL
)
997 error
= dbus_handle_errors(dbus_error
);
998 data
->callback(error
, message_paths
, data
->userdata
);
1000 g_error_free(error
);
1002 if (dbus_error
!= NULL
)
1003 g_error_free(dbus_error
);
1009 opimd_message_folder_get_message_paths(const char *folder_path
,
1010 const gint first
, const gint count
,
1011 void (*callback
) (GError
*, char **,
1015 DBusGProxy
*proxy
= dbus_connect_to_opimd_message_folder(folder_path
);
1016 opimd_message_folder_get_message_paths_data_t
*data
=
1017 g_malloc(sizeof(opimd_message_folder_get_message_paths_data_t
));
1018 data
->callback
= callback
;
1019 data
->userdata
= userdata
;
1020 org_freesmartphone_PIM_MessageFolder_get_message_paths_async(proxy
,
1023 opimd_message_folder_get_message_paths_callback
,
1028 /* --- (signal) MessageMoved ------------------------------------------------------- */
1031 opimd_message_folder_message_moved_handler(DBusGProxy
* proxy
,
1032 char *message_path
, char *new_folder
,
1036 void (*callback
) (char *message_path
, char *new_folder
) = NULL
;
1038 callback
= userdata
;
1040 if (callback
!= NULL
)
1041 (*callback
) (message_path
, new_folder
);