* Enable sort option in header window.
authorJose Dapena Paz <jdapena@igalia.com>
Mon, 17 Nov 2008 17:33:11 +0000 (17:33 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Mon, 17 Nov 2008 17:33:11 +0000 (17:33 +0000)
pmo-drop-split-view-r6319

src/hildon2/modest-header-window.c
src/modest-ui-actions.c
src/modest-utils.c

index b0ebd6f..6a37490 100644 (file)
@@ -451,6 +451,8 @@ static void setup_menu (ModestHeaderWindow *self)
                     G_CALLBACK (modest_ui_actions_on_send_receive));
        add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_inbox_messagedetails"),
                     G_CALLBACK (modest_ui_actions_on_details));
+       add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_inbox_sort"),
+                    G_CALLBACK (modest_ui_actions_on_sort));
 
        hildon_stackable_window_set_main_menu (HILDON_STACKABLE_WINDOW (self), 
                                               HILDON_APP_MENU (app_menu));
index 9f9ffa7..a16034b 100644 (file)
@@ -1910,21 +1910,27 @@ void
 modest_ui_actions_on_sort (GtkAction *action, 
                           ModestWindow *window)
 {
+       GtkWidget *header_view = NULL;
+
        g_return_if_fail (MODEST_IS_WINDOW(window));
 
        if (MODEST_IS_MAIN_WINDOW (window)) {
-               GtkWidget *header_view;
                header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(window),
                                                                   MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-               if (!header_view) {
-                       modest_platform_information_banner (NULL, NULL, _CS("ckdg_ib_nothing_to_sort"));
-
-                       return;
-               }
+#ifdef MODEST_TOOLKIT_HILDON2
+       } else if (MODEST_IS_HEADER_WINDOW (window)) {
+               header_view = GTK_WIDGET (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (window)));
+#endif
+       }
 
-               /* Show sorting dialog */
-               modest_utils_run_sort_dialog (GTK_WINDOW (window), MODEST_SORT_HEADERS);        
+       if (!header_view) {
+               modest_platform_information_banner (NULL, NULL, _CS("ckdg_ib_nothing_to_sort"));
+               
+               return;
        }
+
+       /* Show sorting dialog */
+       modest_utils_run_sort_dialog (GTK_WINDOW (window), MODEST_SORT_HEADERS);        
 }
 
 static void
index aceeafb..bb811e1 100644 (file)
@@ -51,6 +51,9 @@
 #include "widgets/modest-main-window.h"
 #include "modest-widget-memory.h"
 #include "widgets/modest-sort-criterium-view.h"
+#ifdef MODEST_TOOLKIT_HILDON2
+#include "modest-header-window.h"
+#endif
 
 GQuark
 modest_utils_get_supported_secure_authentication_error_quark (void)
@@ -582,6 +585,11 @@ launch_sort_headers_dialog (GtkWindow *parent_window,
        if (MODEST_IS_MAIN_WINDOW (parent_window)) {
                header_view = MODEST_HEADER_VIEW(modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(parent_window),
                                                                                      MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW));
+#ifdef MODEST_TOOLKIT_HILDON2
+       } else if (MODEST_IS_HEADER_WINDOW (parent_window)) {
+               header_view = MODEST_HEADER_VIEW (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (parent_window)));
+#endif
+
        }
        if (!header_view)
                return;