+
+void
+modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+ TnyFolder *folder)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_hildon2_details_dialog_new_with_folder (parent_window, folder);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+void
+modest_platform_run_header_details_dialog (GtkWindow *parent_window,
+ TnyHeader *header)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_hildon2_details_dialog_new_with_header (parent_window, header);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+osso_context_t *
+modest_platform_get_osso_context (void)
+{
+ return modest_maemo_utils_get_osso_context ();
+}
+
+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)
+{
+ TnyList *list = NULL;
+
+ if (MODEST_IS_HEADER_WINDOW (window)) {
+ ModestHeaderView *header_view;
+
+ header_view = modest_header_window_get_header_view (MODEST_HEADER_WINDOW (window));
+ list = modest_header_view_get_selected_headers (header_view);
+ } else if (MODEST_IS_FOLDER_WINDOW (window)) {
+ ModestFolderView *folder_view;
+ TnyFolderStore *selected_folder;
+
+ list = TNY_LIST (tny_simple_list_new ());
+ folder_view = modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (window));
+ selected_folder = modest_folder_view_get_selected (folder_view);
+ if (selected_folder) {
+ tny_list_prepend (list, G_OBJECT (selected_folder));
+ g_object_unref (selected_folder);
+ }
+ return list;
+ } else if (MODEST_IS_MSG_VIEW_WINDOW (window)) {
+ TnyHeader *header;
+
+ header = modest_msg_view_window_get_header (MODEST_MSG_VIEW_WINDOW (window));
+ if (header) {
+ list = TNY_LIST (tny_simple_list_new ());
+ tny_list_prepend (list, G_OBJECT (header));
+ g_object_unref (header);
+ }
+ } else {
+ g_return_val_if_reached (NULL);
+ }
+
+ return list;
+}