* call osso_abook_init before doing anything with the addressbook.
[modest] / src / gnome / modest-platform.c
index e763f7d..0143b45 100644 (file)
 #include "modest-platform.h"
 #include "modest-mail-operation-queue.h"
 #include "modest-runtime.h"
+#include "gnome/modest-gnome-global-settings-dialog.h"
 
 gboolean
-modest_platform_init (void)
+modest_platform_init (int argc, char *argv[])
 {      
        return TRUE; /* nothing to do */
 }
@@ -89,6 +90,13 @@ modest_platform_activate_uri (const gchar *uri)
 }
 
 gboolean 
+modest_platform_activate_file (const gchar *path, const gchar *mime_type)
+{
+       modest_runtime_not_implemented (NULL);
+       return FALSE;
+}
+
+gboolean 
 modest_platform_show_uri_popup (const gchar *uri)
 {
        modest_runtime_not_implemented (NULL);
@@ -121,19 +129,18 @@ modest_platform_get_app_name (void)
        return ("Modest");
 }
 
-gboolean 
-modest_platform_run_new_folder_dialog (ModestWindow *parent_window,
-                                      TnyFolderStore *parent_folder)
+gint 
+modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
+                                      TnyFolderStore *parent_folder,
+                                      gchar *suggested_name,
+                                      gchar **folder_name)
 {
        GtkWidget *dialog, *entry;
-       gchar *folder_name;
-       gboolean finished = FALSE;
-       TnyFolder *new_folder;
-       ModestMailOperation *mail_op;
+       gint result;
 
        /* Ask the user for the folder name */
        dialog = gtk_dialog_new_with_buttons (_("New Folder Name"),
-                                             GTK_WINDOW (parent_window),
+                                             parent_window,
                                              GTK_DIALOG_MODAL,
                                              GTK_STOCK_CANCEL,
                                              GTK_RESPONSE_REJECT,
@@ -150,30 +157,87 @@ modest_platform_run_new_folder_dialog (ModestWindow *parent_window,
                            TRUE, FALSE, 0);
        
        gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
-       
-       if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_REJECT) {
-               gtk_widget_destroy (dialog);
-               return TRUE;
-       }
 
-       folder_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+       result = gtk_dialog_run (GTK_DIALOG(dialog));
+       if (result == GTK_RESPONSE_ACCEPT)
+               *folder_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+
        gtk_widget_destroy (dialog);
 
-       mail_op = modest_mail_operation_new ();
-       modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), 
-                                        mail_op);
-               
-       new_folder = modest_mail_operation_create_folder (mail_op,
-                                                         parent_folder,
-                                                         (const gchar *) folder_name);
-       if (new_folder) {
-               g_object_unref (new_folder);
-               finished = TRUE;
-       }
+       return result;
+}
+
+
+gint
+modest_platform_run_confirmation_dialog (GtkWindow *parent_window,
+                                        const gchar *msg)
+{
+       /* TODO implement confirmation dialog */
+       return GTK_RESPONSE_CANCEL;
+}
+
+void
+modest_platform_run_information_dialog (GtkWindow *parent_window,
+                                       const gchar *message)
+{
+       /* TODO: implement a information dialog */
+}
+
+gboolean modest_platform_connect_and_wait (GtkWindow *parent_window)
+{
+       /* TODO: Do something with network-manager? 
+          Otherwise, maybe it is safe to assume that we would already be online if we could be. */
+       return TRUE;
+}
+
+gboolean modest_platform_set_update_interval (guint minutes)
+{
+       /* TODO. */
+       return FALSE;
+}
+
+void
+modest_platform_run_sort_dialog (GtkWindow *parent_window,
+                                ModestSortDialogType type)
+{
+       /* TODO */
+}
+
+GtkWidget *
+modest_platform_get_global_settings_dialog ()
+{
+       return modest_gnome_global_settings_dialog_new ();
+}
+
+void 
+modest_platform_on_new_msg (void)
+{
+       /* TODO: implement this */
+       g_print ("--------------- NEW MESSAGE ARRIVED ---------------\n");
+}
+
+
+
+gboolean
+modest_platform_show_help (GtkWidget *widget, const gchar *help_id)
+{
+       return TRUE; /* TODO */
+}
+
+void
+modest_platform_show_search_messages (GtkWindow *parent_window)
+{
+       modest_runtime_not_implemented (NULL);
+}
+
+GtkWidget *
+modest_platform_create_folder_view (TnyFolderStoreQuery *query)
+{
+       GtkWidget *widget = modest_folder_view_new (query);
 
-       /* Frees */             
-       g_object_unref (mail_op);
-       g_free (folder_name);
+       /* Show all accounts by default */
+       modest_folder_view_set_style (MODEST_FOLDER_VIEW (widget),
+                                     MODEST_FOLDER_VIEW_STYLE_SHOW_ALL);
 
-       return finished;
+       return widget;
 }