+
+static void
+_modest_platform_play_email_tone (void)
+{
+ gchar *active_profile;
+ gchar *mail_tone;
+ gchar *mail_volume;
+ gint mail_volume_int;
+ int ret;
+ ca_context *ca_con = NULL;
+ ca_proplist *pl = NULL;
+
+ active_profile = profile_get_profile ();
+ mail_tone = profile_get_value (active_profile, PROFILE_MAIL_TONE);
+ mail_volume = profile_get_value (active_profile, PROFILE_MAIL_VOLUME);
+ mail_volume_int = profile_parse_int (mail_volume);
+
+ if (mail_volume_int > 0) {
+
+ if ((ret = ca_context_create(&ca_con)) != CA_SUCCESS) {
+ g_warning("ca_context_create: %s\n", ca_strerror(ret));
+ return;
+ }
+
+ if ((ret = ca_context_open(ca_con)) != CA_SUCCESS) {
+ g_warning("ca_context_open: %s\n", ca_strerror(ret));
+ ca_context_destroy(ca_con);
+ return;
+ }
+
+ ca_proplist_create(&pl);
+ ca_proplist_sets(pl, CA_PROP_MEDIA_FILENAME, mail_tone);
+ ca_proplist_setf(pl, CA_PROP_CANBERRA_VOLUME, "%f", (gfloat) mail_volume_int);
+
+ ret = ca_context_play_full(ca_con, 0, pl, NULL, NULL);
+ g_debug("ca_context_play_full (vol %f): %s\n", (gfloat) mail_volume_int, ca_strerror(ret));
+
+ ca_proplist_destroy(pl);
+ ca_context_destroy(ca_con);
+ }
+
+ g_free (mail_volume);
+ g_free (mail_tone);
+ g_free (active_profile);
+}
+
+static void
+on_move_to_dialog_folder_activated (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ gtk_dialog_response (GTK_DIALOG (user_data), GTK_RESPONSE_OK);
+}
+
+GtkWidget *
+modest_platform_create_move_to_dialog (GtkWindow *parent_window,
+ GtkWidget **folder_view)
+{
+ GtkWidget *dialog, *folder_view_container;
+
+ /* Create dialog. We cannot use a touch selector because we
+ need to use here the folder view widget directly */
+ dialog = gtk_dialog_new_with_buttons (_("mcen_ti_moveto_folders_title"),
+ GTK_WINDOW (parent_window),
+ GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ _("mcen_bd_new"), MODEST_GTK_RESPONSE_NEW_FOLDER,
+ NULL);
+
+ /* Create folder view */
+ *folder_view = modest_platform_create_folder_view (NULL);
+
+ /* Simulate the behaviour of a HildonPickerDialog by emitting
+ a response when a folder is selected */
+ g_signal_connect (*folder_view, "row-activated",
+ G_CALLBACK (on_move_to_dialog_folder_activated),
+ dialog);
+
+ /* Create pannable and add it to the dialog */
+ folder_view_container = hildon_pannable_area_new ();
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), folder_view_container);
+ gtk_container_add (GTK_CONTAINER (folder_view_container), *folder_view);
+
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 300);
+
+ gtk_widget_show (GTK_DIALOG (dialog)->vbox);
+ gtk_widget_show (folder_view_container);
+ gtk_widget_show (*folder_view);
+
+ return dialog;
+}
+
+TnyList *
+modest_platform_get_list_to_move (ModestWindow *window)
+{
+ ModestHeaderView *header_view;
+
+ header_view = modest_header_window_get_header_view (MODEST_HEADER_WINDOW (window));
+
+ return modest_header_view_get_selected_headers (header_view);
+}