* Fix behavior of check names for fremantle.
[modest] / src / hildon2 / modest-platform.c
index db2b25a..9092493 100644 (file)
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
 #include <modest-account-settings-dialog.h>
 #include <modest-easysetup-wizard-dialog.h>
-#include "modest-hildon-sort-dialog.h"
+#include "modest-hildon2-sort-dialog.h"
 #include <hildon/hildon-sound.h>
 #include <osso-mem.h>
+#include "hildon2/modest-hildon2-details-dialog.h"
 
 #ifdef MODEST_HAVE_MCE
 #include <mce/dbus-names.h>
@@ -571,13 +572,13 @@ entry_changed (GtkEditable *editable,
        GList *buttons;
 
        buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (user_data)->action_area));
-       ok_button = GTK_WIDGET (buttons->next->data);
+       ok_button = GTK_WIDGET (buttons->data);
        
        chars = gtk_editable_get_chars (editable, 0, -1);
        g_return_if_fail (chars != NULL);
 
        
-       if (g_utf8_strlen (chars,-1) >= 21)
+       if (g_utf8_strlen (chars,-1) >= 20)
                hildon_banner_show_information  (gtk_widget_get_parent (GTK_WIDGET (user_data)), NULL,
                                                 _CS("ckdg_ib_maximum_characters_reached"));
        else
@@ -662,21 +663,19 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window,
        dialog = gtk_dialog_new_with_buttons (dialog_title,
                                              parent_window,
                                              GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                             _("mcen_bd_dialog_ok"),
+                                             _HL("wdgt_bd_done"),
                                              GTK_RESPONSE_ACCEPT,
-                                             _("mcen_bd_dialog_cancel"),
-                                             GTK_RESPONSE_REJECT,
                                              NULL);
 
        /* Add accept button (with unsensitive handler) */
        buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area));
-       accept_btn = GTK_WIDGET (buttons->next->data);
+       accept_btn = GTK_WIDGET (buttons->data);
        /* Create label and entry */
        label = gtk_label_new (label_text);
-       /* TODO: check that the suggested name does not exist */
-       /* We set 21 as maximum because we want to show WID-INF036
-          when the user inputs more that 20 */
-       entry = gtk_entry_new_with_max_length (21);
+
+       entry = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
+       gtk_entry_set_max_length (GTK_ENTRY (entry), 20);
+
        if (suggested_name)
                gtk_entry_set_text (GTK_ENTRY (entry), suggested_name);
        else
@@ -853,6 +852,7 @@ modest_platform_run_confirmation_dialog_with_buttons (GtkWindow *parent_window,
                                                           button_accept, GTK_RESPONSE_ACCEPT,
                                                           button_cancel, GTK_RESPONSE_CANCEL,
                                                           NULL);
+
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), 
                                     GTK_WINDOW (dialog), parent_window);
 
@@ -863,27 +863,6 @@ modest_platform_run_confirmation_dialog_with_buttons (GtkWindow *parent_window,
        return response;
 }
        
-gint
-modest_platform_run_yes_no_dialog (GtkWindow *parent_window,
-                                  const gchar *message)
-{
-       GtkWidget *dialog;
-       gint response;
-       
-       dialog = hildon_note_new_confirmation_add_buttons (parent_window, message,
-                                                          _("mcen_bd_yes"), GTK_RESPONSE_YES,
-                                                          _("mcen_bd_no"), GTK_RESPONSE_NO,
-                                                          NULL);
-       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), parent_window);
-       response = gtk_dialog_run (GTK_DIALOG (dialog));
-       
-       on_destroy_dialog (dialog);
-
-       return response;
-}
-
-
-
 void
 modest_platform_run_information_dialog (GtkWindow *parent_window,
                                        const gchar *message,
@@ -1085,11 +1064,7 @@ modest_platform_create_sort_dialog       (GtkWindow *parent_window)
 {
        GtkWidget *dialog;
 
-       dialog = modest_hildon_sort_dialog_new (parent_window);
-
-       hildon_help_dialog_help_enable (GTK_DIALOG(dialog),
-                                       "applications_email_sort",
-                                       modest_maemo_utils_get_osso_context());
+       dialog = modest_hildon2_sort_dialog_new (parent_window);
 
        return dialog;
 }
@@ -1397,20 +1372,7 @@ void
 modest_platform_show_help (GtkWindow *parent_window, 
                           const gchar *help_id)
 {
-       osso_return_t result;
-       g_return_if_fail (help_id);
-
-       result = hildon_help_show (modest_maemo_utils_get_osso_context(),
-                                  help_id, HILDON_HELP_SHOW_DIALOG);
-       
-       if (result != OSSO_OK) {
-               gchar *error_msg;
-               error_msg = g_strdup_printf ("FIXME The help topic %s could not be found", help_id); 
-               hildon_banner_show_information (GTK_WIDGET (parent_window),
-                                               NULL,
-                                               error_msg);
-               g_free (error_msg);
-       }
+       return;
 }
 
 void 
@@ -1601,6 +1563,8 @@ on_timeout_check_account_is_online(CheckAccountIdleData* data)
 gboolean
 modest_platform_check_and_wait_for_account_is_online(TnyAccount *account)
 {
+       gboolean is_online;
+
        g_return_val_if_fail (account, FALSE);
        
        printf ("DEBUG: %s: account id=%s\n", __FUNCTION__, tny_account_get_id (account));
@@ -1644,9 +1608,10 @@ modest_platform_check_and_wait_for_account_is_online(TnyAccount *account)
        g_main_loop_unref (data->loop);
        /* g_main_context_unref (context); */
 
+       is_online = data->is_online;
        g_slice_free (CheckAccountIdleData, data);
        
-       return data->is_online; 
+       return is_online;       
 }
 
 
@@ -1699,9 +1664,9 @@ modest_platform_run_certificate_confirmation_dialog (const gchar* server_name,
        note = hildon_note_new_confirmation_add_buttons  (
                GTK_WINDOW(main_win),
                question,
-               _("mcen_bd_dialog_ok"),     GTK_RESPONSE_OK,
-               _("mcen_bd_view"),          GTK_RESPONSE_APPLY,   /* abusing this... */
-               _("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL,
+               _HL("wdgt_bd_yes"),     GTK_RESPONSE_OK,
+               _HL("wdgt_bd_view"),          GTK_RESPONSE_APPLY,   /* abusing this... */
+               _HL("wdgt_bd_no"), GTK_RESPONSE_CANCEL,
                NULL, NULL);
        
        g_signal_connect (G_OBJECT(note), "response", 
@@ -2117,3 +2082,49 @@ modest_platform_check_memory_low (ModestWindow *win,
 
        return lowmem;
 }
+
+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 ();
+}