add 'Re-edit' to the message context menu in the Drafts folder
authorPaul <paul@claws-mail.org>
Tue, 1 Oct 2019 16:22:11 +0000 (17:22 +0100)
committerPaul <paul@claws-mail.org>
Tue, 1 Oct 2019 16:22:11 +0000 (17:22 +0100)
src/gtk/menu.c
src/mainwindow.c
src/mainwindow.h
src/summaryview.c

index 050b109..558869d 100644 (file)
@@ -94,6 +94,10 @@ void cm_menu_set_sensitive_full(GtkUIManager *gui_manager, const gchar *menu, gb
        }
 
        gtk_widget_set_sensitive(widget, sensitive);
+
+       if (strcmp(menu, "Menus/SummaryViewPopup/Reedit") == 0)
+               (sensitive)? gtk_widget_show(widget) : gtk_widget_hide(widget);
+
        g_free(path);
 }
 
index 60fa66d..315ab7c 100644 (file)
@@ -3016,6 +3016,10 @@ SensitiveCondMask main_window_get_current_state(MainWindow *mainwin)
            && mainwin->summaryview->folder_item->stype != F_DRAFT)
                UPDATE_STATE(M_NOT_DRAFT);
 
+       if (mainwin->summaryview->folder_item &&
+           mainwin->summaryview->folder_item->stype == F_DRAFT)
+               UPDATE_STATE(M_DRAFT);
+
        if (prefs_common.actions_list && g_slist_length(prefs_common.actions_list))
                UPDATE_STATE(M_ACTIONS_EXIST);
 
index ce0b30c..0d1ffb1 100644 (file)
@@ -70,6 +70,7 @@ typedef enum
        M_HAVE_RETRIEVABLE_ACCOUNT,
        M_HAVE_ANY_RETRIEVABLE_ACCOUNT,
        M_NOT_DRAFT,
+       M_DRAFT,
 
 /* reserved */
     M_MAX_RESERVED
index 40cbe14..d10ef78 100644 (file)
@@ -420,12 +420,14 @@ GtkTargetEntry summary_drag_types[3] =
        {"claws-mail/msg-path-list", 0, TARGET_MAIL_CM_PATH_LIST},
 };
 
+static void summary_reedit_cb(GtkAction *gaction, gpointer data);
 static void summary_reply_cb(GtkAction *gaction, gpointer data);
 
 /* Only submenus and specifically-handled menu entries here */
 static GtkActionEntry summary_popup_entries[] =
 {
        {"SummaryViewPopup",                      NULL, "SummaryViewPopup", NULL, NULL, NULL },
+       {"SummaryViewPopup/Reedit",               NULL, N_("Re-edit"), NULL, NULL, G_CALLBACK(summary_reedit_cb) },
        {"SummaryViewPopup/Reply",                NULL, N_("_Reply"), NULL, NULL, G_CALLBACK(summary_reply_cb) }, /* COMPOSE_REPLY */
        {"SummaryViewPopup/ReplyTo",              NULL, N_("Repl_y to"), NULL, NULL, NULL },
        {"SummaryViewPopup/ReplyTo/All",          NULL, N_("_All"), NULL, NULL, G_CALLBACK(summary_reply_cb) }, /* COMPOSE_REPLY_TO_ALL */
@@ -710,6 +712,7 @@ SummaryView *summary_create(MainWindow *mainwin)
                        G_N_ELEMENTS(summary_popup_entries), (gpointer)summaryview);
 
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus", "SummaryViewPopup", "SummaryViewPopup", GTK_UI_MANAGER_MENU)
+       MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Reedit", "SummaryViewPopup/Reedit", GTK_UI_MANAGER_MENUITEM)
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Reply", "SummaryViewPopup/Reply", GTK_UI_MANAGER_MENUITEM)
 #ifndef GENERIC_UMPC
        MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "ReplyTo", "SummaryViewPopup/ReplyTo", GTK_UI_MANAGER_MENU)
@@ -1816,9 +1819,9 @@ void summary_set_menu_sensitive(SummaryView *summaryview)
        gint i;
 
 #ifndef GENERIC_UMPC
-#define N_ENTRIES 39
+#define N_ENTRIES 40
 #else
-#define N_ENTRIES 28
+#define N_ENTRIES 29
 #endif
        static struct {
                const gchar *entry;
@@ -1831,6 +1834,7 @@ do { \
        entry[i].entry = (const gchar *) entry_str; entry[i++].cond = main_window_get_mask(__VA_ARGS__, -1); \
 } while (0)
 
+       FILL_TABLE("Menus/SummaryViewPopup/Reedit", M_TARGET_EXIST, M_DRAFT);
        FILL_TABLE("Menus/SummaryViewPopup/Reply", M_HAVE_ACCOUNT, M_TARGET_EXIST);
 #ifndef GENERIC_UMPC
        FILL_TABLE("Menus/SummaryViewPopup/ReplyTo", M_HAVE_ACCOUNT, M_TARGET_EXIST);
@@ -8521,6 +8525,12 @@ void summaryview_unlock(SummaryView *summaryview, FolderItem *item)
        gtk_widget_set_sensitive(summaryview->ctree, TRUE);
 }
 
+static void summary_reedit_cb(GtkAction *gaction, gpointer data)
+{
+       SummaryView *summaryview = (SummaryView *)data;
+       summary_reedit(summaryview);
+}
+
 #define DO_ACTION(name, act)   { if (!strcmp(a_name, name)) action = act; }
 static void summary_reply_cb(GtkAction *gaction, gpointer data)
 {