* src/modest-ui-actions.[ch]:
authorJose Dapena Paz <jdapena@igalia.com>
Sat, 12 Jan 2008 17:06:59 +0000 (17:06 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Sat, 12 Jan 2008 17:06:59 +0000 (17:06 +0000)
        * Added new method to create new folder or message depending on
          where's the focus.
* src/maemo/modest-main-window-ui.h:
        * Now + toolbar button creates a new folder if focus is on a
          folder (fixes NB#79232).

pmo-trunk-r4024

src/maemo/modest-main-window-ui.h
src/modest-ui-actions.c
src/modest-ui-actions.h

index 9da7705..ddb6c15 100644 (file)
@@ -112,7 +112,7 @@ static const GtkActionEntry modest_action_entries [] = {
         * but we need to specificy them differently, they have icons for example
         */
        /* Headers Toolbar */
         * but we need to specificy them differently, they have icons for example
         */
        /* Headers Toolbar */
-       { "ToolbarMessageNew",        MODEST_STOCK_NEW_MAIL,     N_("qgn_toolb_messagin_new"), NULL, NULL,  G_CALLBACK (modest_ui_actions_on_new_msg) },
+       { "ToolbarMessageNew",        MODEST_STOCK_NEW_MAIL,     N_("qgn_toolb_messagin_new"), NULL, NULL,  G_CALLBACK (modest_ui_actions_on_new_msg_or_folder) },
        { "ToolbarMessageReply",      MODEST_STOCK_REPLY,     N_("mcen_me_inbox_reply"),      "<CTRL>R", NULL,  G_CALLBACK (modest_ui_actions_on_reply) },
        { "ToolbarMessageReplyAll",   MODEST_STOCK_REPLY_ALL,     N_("mcen_me_inbox_replytoall"),         NULL, NULL,  G_CALLBACK (modest_ui_actions_on_reply_all) },
        { "ToolbarMessageForward",    MODEST_STOCK_FORWARD,     N_("mcen_me_inbox_forward"),      NULL, NULL,  G_CALLBACK (modest_ui_actions_on_forward) },
        { "ToolbarMessageReply",      MODEST_STOCK_REPLY,     N_("mcen_me_inbox_reply"),      "<CTRL>R", NULL,  G_CALLBACK (modest_ui_actions_on_reply) },
        { "ToolbarMessageReplyAll",   MODEST_STOCK_REPLY_ALL,     N_("mcen_me_inbox_replytoall"),         NULL, NULL,  G_CALLBACK (modest_ui_actions_on_reply_all) },
        { "ToolbarMessageForward",    MODEST_STOCK_FORWARD,     N_("mcen_me_inbox_forward"),      NULL, NULL,  G_CALLBACK (modest_ui_actions_on_forward) },
index 7d2660b..18f87d8 100644 (file)
@@ -813,6 +813,26 @@ modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win)
        modest_ui_actions_compose_msg(win, NULL, NULL, NULL, NULL, NULL, NULL);
 }
 
        modest_ui_actions_compose_msg(win, NULL, NULL, NULL, NULL, NULL, NULL);
 }
 
+void
+modest_ui_actions_on_new_msg_or_folder (GtkAction *action, ModestWindow *win)
+{
+       g_return_if_fail (MODEST_IS_WINDOW (win));
+
+       /* Check first if the header view has the focus */
+       if (MODEST_IS_MAIN_WINDOW (win)) {
+               GtkWidget *w;
+               w = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
+                                                        MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
+               if (gtk_widget_is_focus (w)) {
+                       modest_ui_actions_on_new_folder (action, MODEST_MAIN_WINDOW(win));
+                       return;
+               }
+       }
+
+       modest_ui_actions_on_new_msg (action, win);
+}
+
+
 gboolean 
 modest_ui_actions_msg_retrieval_check (ModestMailOperation *mail_op,
                                       TnyHeader *header,
 gboolean 
 modest_ui_actions_msg_retrieval_check (ModestMailOperation *mail_op,
                                       TnyHeader *header,
index c9dd225..66e36de 100644 (file)
@@ -67,6 +67,8 @@ void     modest_ui_actions_on_check_names (GtkAction *action, ModestMsgEditWindo
 
 void     modest_ui_actions_on_new_msg       (GtkAction *action, ModestWindow *win);
 
 
 void     modest_ui_actions_on_new_msg       (GtkAction *action, ModestWindow *win);
 
+void     modest_ui_actions_on_new_msg_or_folder (GtkAction *action, ModestWindow *win);
+
 void     modest_ui_actions_on_open           (GtkAction *action, ModestWindow *win);
 
 void     modest_ui_actions_on_reply         (GtkAction *action, ModestWindow *win);
 void     modest_ui_actions_on_open           (GtkAction *action, ModestWindow *win);
 
 void     modest_ui_actions_on_reply         (GtkAction *action, ModestWindow *win);