* Added modest_platform_create_folder_view
authorSergio Villar Senin <svillar@igalia.com>
Thu, 14 Jun 2007 14:52:59 +0000 (14:52 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 14 Jun 2007 14:52:59 +0000 (14:52 +0000)
* Fixes NB#59468, the move to folder shows the folder view even if there is no main window

pmo-trunk-r2235

src/gnome/modest-platform.c
src/maemo/modest-main-window.c
src/maemo/modest-platform.c
src/modest-platform.h
src/modest-ui-actions.c
src/widgets/modest-folder-view.c

index 861eca3..c92d1da 100644 (file)
@@ -229,3 +229,15 @@ modest_platform_show_search_messages (GtkWindow *parent_window)
 {
        modest_runtime_not_implemented (NULL);
 }
 {
        modest_runtime_not_implemented (NULL);
 }
+
+GtkWidget *
+modest_platform_create_folder_view (TnyFolderStoreQuery *query)
+{
+       GtkWidget *widget = modest_folder_view_new (query);
+
+       /* Show all accounts by default */
+       modest_folder_view_set_style (MODEST_FOLDER_VIEW (widget),
+                                     MODEST_FOLDER_VIEW_STYLE_SHOW_ALL);
+
+       return widget;
+}
index 860ea84..f70dab8 100644 (file)
@@ -625,19 +625,13 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
        GtkWidget *folder_win = (GtkWidget *) user_data;
        ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
        
        GtkWidget *folder_win = (GtkWidget *) user_data;
        ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
        
-       priv->folder_view = MODEST_FOLDER_VIEW(modest_folder_view_new (NULL));
-       if (!priv->folder_view)
-               g_printerr ("modest: cannot instantiate folder view\n");
+       priv->folder_view = MODEST_FOLDER_VIEW (modest_platform_create_folder_view (NULL));
 
        gtk_widget_show (GTK_WIDGET (priv->folder_view));
 
        /* Connect signals */
        connect_signals ((ModestMainWindow*)self);
 
 
        gtk_widget_show (GTK_WIDGET (priv->folder_view));
 
        /* Connect signals */
        connect_signals ((ModestMainWindow*)self);
 
-       modest_folder_view_set_style (priv->folder_view,
-                     MODEST_FOLDER_VIEW_STYLE_SHOW_ONE);
-
-
        /* Set account store */
        tny_account_store_view_set_account_store (TNY_ACCOUNT_STORE_VIEW (priv->folder_view),
                                                  TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
        /* Set account store */
        tny_account_store_view_set_account_store (TNY_ACCOUNT_STORE_VIEW (priv->folder_view),
                                                  TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
@@ -649,7 +643,7 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
        
        /* Load previous osso state, for instance if we are being restored from 
         * hibernation:  */
        
        /* Load previous osso state, for instance if we are being restored from 
         * hibernation:  */
-       modest_osso_load_state();
+       modest_osso_load_state ();
 
        /* Restore window & widget settings */
        
 
        /* Restore window & widget settings */
        
@@ -665,7 +659,6 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
                gtk_widget_show_all(GTK_WIDGET(self));
                modest_ui_actions_on_accounts (NULL, MODEST_WINDOW(self));
        }
                gtk_widget_show_all(GTK_WIDGET(self));
                modest_ui_actions_on_accounts (NULL, MODEST_WINDOW(self));
        }
-
 }
 
 ModestWindow*
 }
 
 ModestWindow*
@@ -771,8 +764,8 @@ modest_main_window_new (void)
        modest_maemo_utils_get_device_name ();
 
        /* header view */
        modest_maemo_utils_get_device_name ();
 
        /* header view */
-       priv->header_view  =
-               MODEST_HEADER_VIEW(modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_DETAILS));
+       priv->header_view =
+               MODEST_HEADER_VIEW (modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_DETAILS));
        if (!priv->header_view)
                g_printerr ("modest: cannot instantiate header view\n");
        modest_header_view_set_style (priv->header_view, MODEST_HEADER_VIEW_STYLE_TWOLINES);
        if (!priv->header_view)
                g_printerr ("modest: cannot instantiate header view\n");
        modest_header_view_set_style (priv->header_view, MODEST_HEADER_VIEW_STYLE_TWOLINES);
index e8c15aa..bd8a6ad 100644 (file)
@@ -34,7 +34,7 @@
 #include <modest-main-window.h>
 #include <modest-header-view.h>
 #include "maemo/modest-maemo-global-settings-dialog.h"
 #include <modest-main-window.h>
 #include <modest-header-view.h>
 #include "maemo/modest-maemo-global-settings-dialog.h"
-
+#include "modest-widget-memory.h"
 #include <modest-hildon-includes.h>
 #include <osso-helplib.h>
 #include <dbus_api/modest-dbus-callbacks.h>
 #include <modest-hildon-includes.h>
 #include <osso-helplib.h>
 #include <dbus_api/modest-dbus-callbacks.h>
@@ -816,7 +816,7 @@ modest_platform_on_new_msg (void)
                                       "system.note.dialog");
 
        /* Play sound SR-SND-18. TODO: play the right file */
                                       "system.note.dialog");
 
        /* Play sound SR-SND-18. TODO: play the right file */
-/*     hildon_notification_set_sound (not, "/usr/share/sounds/ui-battery_low.wav"); */
+/*     hildon_notification_set_sound (not, "/usr/share/sounds/ui-new_email.wav"); */
 
        /* Set the led pattern */
        notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (not), "led-pattern", 3);
 
        /* Set the led pattern */
        notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (not), "led-pattern", 3);
@@ -879,3 +879,20 @@ modest_platform_show_addressbook (GtkWindow *parent_window)
                /* TODO: warning about error showing dialog */
        }
 }
                /* TODO: warning about error showing dialog */
        }
 }
+
+GtkWidget *
+modest_platform_create_folder_view (TnyFolderStoreQuery *query)
+{
+       GtkWidget *widget = modest_folder_view_new (query);
+
+       /* Show all accounts by default */
+       modest_folder_view_set_style (MODEST_FOLDER_VIEW (widget),
+                                     MODEST_FOLDER_VIEW_STYLE_SHOW_ONE);
+
+       /* Restore settings */
+       modest_widget_memory_restore (modest_runtime_get_conf(), 
+                                     G_OBJECT (widget),
+                                     MODEST_CONF_FOLDER_VIEW_KEY);
+
+       return widget;
+}
index 0bb7952..0d6f41c 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <tny-device.h>
 #include "widgets/modest-window.h"
 
 #include <tny-device.h>
 #include "widgets/modest-window.h"
+#include "widgets/modest-folder-view.h"
 
 G_BEGIN_DECLS
 
 
 G_BEGIN_DECLS
 
@@ -241,6 +242,9 @@ void modest_platform_show_search_messages (GtkWindow *parent_window);
  **/
 void modest_platform_show_addressbook (GtkWindow *parent_window);
 
  **/
 void modest_platform_show_addressbook (GtkWindow *parent_window);
 
+
+GtkWidget* modest_platform_create_folder_view (TnyFolderStoreQuery *query);
+
 G_END_DECLS
 
 #endif /* __MODEST_PLATFORM_UTILS_H__ */
 G_END_DECLS
 
 #endif /* __MODEST_PLATFORM_UTILS_H__ */
index 71ff9dc..71f925f 100644 (file)
@@ -2577,7 +2577,7 @@ create_move_to_dialog (ModestWindow *win,
                                         GTK_POLICY_AUTOMATIC);
 
        /* Create folder view */
                                         GTK_POLICY_AUTOMATIC);
 
        /* Create folder view */
-       *tree_view = modest_folder_view_new (NULL);
+       *tree_view = modest_platform_create_folder_view (NULL);
 
        /* It could happen that we're trying to move a message from a
           window (msg window for example) after the main window was
 
        /* It could happen that we're trying to move a message from a
           window (msg window for example) after the main window was
@@ -2598,6 +2598,9 @@ create_move_to_dialog (ModestWindow *win,
 
        gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
 
 
        gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
 
+       /* Select INBOX or local account */
+       modest_folder_view_select_first_inbox_or_local (MODEST_FOLDER_VIEW (*tree_view));
+
        return dialog;
 }
 
        return dialog;
 }
 
index 0c4dbe8..e86574f 100644 (file)
@@ -1663,8 +1663,6 @@ find_inbox_iter (GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *inbox_iter
        return FALSE;
 }
 
        return FALSE;
 }
 
-
-
 void 
 modest_folder_view_select_first_inbox_or_local (ModestFolderView *self)
 {
 void 
 modest_folder_view_select_first_inbox_or_local (ModestFolderView *self)
 {
@@ -1674,7 +1672,7 @@ modest_folder_view_select_first_inbox_or_local (ModestFolderView *self)
 
        /* Do not set it if the folder view was not painted */
        if (!GTK_WIDGET_MAPPED (self))
 
        /* Do not set it if the folder view was not painted */
        if (!GTK_WIDGET_MAPPED (self))
-               return;
+               return; 
 
        model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
        if (!model)
 
        model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
        if (!model)