* Migrated both the Folder and Message details dialog to Fremantle UI, now they...
[modest] / src / gnome / modest-platform.c
index 41feb01..28885ee 100644 (file)
 #include "modest-runtime.h"
 
 #include "gnome/modest-gnome-global-settings-dialog.h"
+#include "widgets/modest-account-settings-dialog.h"
+#include "gnome/modest-account-assistant.h"
+#include "gnome/modest-gnome-sort-dialog.h"
+#include "widgets/modest-details-dialog.h"
 
 gboolean
 modest_platform_init (int argc, char *argv[])
@@ -123,9 +127,15 @@ modest_platform_get_icon (const gchar *name, guint icon_size)
        pixbuf = gdk_pixbuf_new_from_file (name, &err);
 
        if (!pixbuf) {
-               g_printerr ("modest: error while loading icon '%s': %s\n",
-                           name, err->message);
+/*             g_printerr ("modest: error while loading icon '%s': %s\n", */
+/*                         name, err->message); */
                g_error_free (err);
+               err = NULL;
+
+               pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), name, icon_size, 0, &err);
+               if (!pixbuf) {
+                       g_error_free (err);
+               }
        }
        
        return pixbuf;
@@ -309,11 +319,10 @@ gboolean modest_platform_set_update_interval (guint minutes)
        return FALSE;
 }
 
-void
-modest_platform_run_sort_dialog (GtkWindow *parent_window,
-                                ModestSortDialogType type)
+GtkWidget *
+modest_platform_create_sort_dialog (GtkWindow *parent_window)
 {
-       /* TODO */
+       return modest_gnome_sort_dialog_new (parent_window);
 }
 
 GtkWidget *
@@ -417,7 +426,7 @@ modest_platform_double_connect_and_perform (GtkWindow *parent_window,
                                            DoubleConnectionInfo *connect_info)
 {
        if (connect_info->callback)
-               connect_info->callback (FALSE, NULL, parent_window, folder_store, connect_info->data);
+               connect_info->callback (FALSE, NULL, parent_window, TNY_ACCOUNT (folder_store), connect_info->data);
 }
 
 void 
@@ -482,17 +491,64 @@ modest_platform_show_addressbook (GtkWindow *parent_window)
 GtkWidget *
 modest_platform_get_account_settings_dialog (ModestAccountSettings *settings)
 {
-       GtkWidget *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
-                                                   GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
-                                                   "NOT IMPLEMENTED");
-       return dialog;
+       ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new ();
+
+       modest_account_settings_dialog_set_account (dialog, settings);
+       return GTK_WIDGET (dialog);
 }
 
 GtkWidget *
-modest_platform_get_account_settings_wizard ()
+modest_platform_get_account_settings_wizard (void)
+{
+       GtkWidget *widget = modest_account_assistant_new (modest_runtime_get_account_mgr ());
+       return widget;
+}
+
+
+
+gboolean modest_platform_check_memory_low (ModestWindow *win,
+                                          gboolean visuals)
+{
+       g_debug ("%s not implemented", __FUNCTION__);
+       return FALSE;
+}
+
+void 
+modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+                                          TnyFolder *folder)
 {
-       GtkWidget *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
-                                                   GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
-                                                   "NOT IMPLEMENTED");
-       return dialog;
+       GtkWidget *dialog;
+       
+       /* Create dialog */
+       dialog = modest_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_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);
 }