[balsa/69-resend-message: 12/17] Various: Add a toolbar to the resend window




commit 7ba7ca3387d0a47a51b372d2caf8714bd0f16373
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Mar 2 16:27:51 2022 -0500

    Various: Add a toolbar to the resend window
    
    modified:   src/sendmsg-window.c
    modified:   src/sendmsg-window.h
    modified:   src/toolbar-factory.c
    modified:   src/toolbar-factory.h
    modified:   src/toolbar-prefs.c
    modified:   ui/resend-window.ui

 src/sendmsg-window.c  | 60 ++++++++++++++++++++++++++++++++++++++++++++++-----
 src/sendmsg-window.h  |  3 +++
 src/toolbar-factory.c |  2 +-
 src/toolbar-factory.h |  1 +
 src/toolbar-prefs.c   |  9 ++++++++
 ui/resend-window.ui   |  7 ++++++
 6 files changed, 76 insertions(+), 6 deletions(-)
---
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 23457ca0c..4c0765199 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -4251,6 +4251,10 @@ create_lang_menu(GtkWidget * parent, BalsaSendmsg * bsmsg)
     return g_object_get_data(G_OBJECT(active_item), BALSA_LANGUAGE_MENU_LANG);
 }
 
+/*
+ * Compose window toolbar
+ */
+
 /* Standard buttons; "" means a separator. */
 static const BalsaToolbarEntry compose_toolbar[] = {
     { "toolbar-send", BALSA_PIXMAP_SEND       },
@@ -4301,6 +4305,51 @@ sendmsg_window_get_toolbar_model(void)
     return model;
 }
 
+/*
+ * Resend window toolbar
+ */
+
+/* Standard buttons; "" means a separator. */
+static const BalsaToolbarEntry resend_toolbar[] = {
+    { "toolbar-send", BALSA_PIXMAP_SEND       },
+    { "", ""                                  },
+    { "save",        "document-save"          },
+    { "", ""                                  },
+    { "select-ident", BALSA_PIXMAP_IDENTITY   },
+    { "", ""                                  },
+    {"close",        "window-close-symbolic"  }
+};
+
+/* Optional extra buttons */
+static const BalsaToolbarEntry resend_toolbar_extras[] = {
+    { "postpone",    BALSA_PIXMAP_POSTPONE    },
+    { "queue",       BALSA_PIXMAP_QUEUE       }
+};
+
+/* Create the toolbar model for the resend window's toolbar.
+ */
+BalsaToolbarModel *
+resend_window_get_toolbar_model(void)
+{
+    static BalsaToolbarModel *model = NULL;
+
+    if (model)
+        return model;
+
+    model =
+        balsa_toolbar_model_new(BALSA_TOOLBAR_TYPE_RESEND_WINDOW,
+                                resend_toolbar,
+                                G_N_ELEMENTS(resend_toolbar));
+    balsa_toolbar_model_add_entries(model, resend_toolbar_extras,
+                                    G_N_ELEMENTS(resend_toolbar_extras));
+
+    return model;
+}
+
+/*
+ * End of toolbars
+ */
+
 static void
 bsmsg_identities_changed_cb(BalsaSendmsg * bsmsg)
 {
@@ -6891,12 +6940,13 @@ sendmsg_window_new(SendType send_type)
     gtk_box_pack_start(GTK_BOX(main_box), menubar, FALSE, FALSE, 0);
 #endif
 
-    if (send_type != SEND_RESEND) {
-        model = sendmsg_window_get_toolbar_model();
-        bsmsg->toolbar = balsa_toolbar_new(model, G_ACTION_MAP(window));
-        gtk_box_pack_start(GTK_BOX(main_box), bsmsg->toolbar,
-                           FALSE, FALSE, 0);
+    model = send_type == SEND_RESEND ?
+        resend_window_get_toolbar_model() :
+        sendmsg_window_get_toolbar_model();
+    bsmsg->toolbar = balsa_toolbar_new(model, G_ACTION_MAP(window));
+    gtk_box_pack_start(GTK_BOX(main_box), bsmsg->toolbar, FALSE, FALSE, 0);
 
+    if (send_type != SEND_RESEND) {
         bsmsg->flow = !balsa_app.wordwrap;
         sw_action_set_enabled(bsmsg, "reflow", bsmsg->flow);
         bsmsg->send_mp_alt = FALSE;
diff --git a/src/sendmsg-window.h b/src/sendmsg-window.h
index d1125ec3b..01c95f3a2 100644
--- a/src/sendmsg-window.h
+++ b/src/sendmsg-window.h
@@ -133,9 +133,12 @@ G_BEGIN_DECLS
     BalsaSendmsg *sendmsg_window_new_from_list(LibBalsaMailbox * mailbox,
                                                GArray * selected,
                                                SendType type);
+
     BalsaToolbarModel *sendmsg_window_get_toolbar_model(void);
     void sendmsg_window_add_action_entries(GActionMap * action_map);
 
+    BalsaToolbarModel *resend_window_get_toolbar_model(void);
+
 G_END_DECLS
 
 #endif                         /* __BALSA_SENDMSG_H__ */
diff --git a/src/toolbar-factory.c b/src/toolbar-factory.c
index cc8726f5a..2abd1c5ef 100644
--- a/src/toolbar-factory.c
+++ b/src/toolbar-factory.c
@@ -36,7 +36,7 @@
 
 /* Must be consistent with BalsaToolbarType enum: */
 static const gchar *const balsa_toolbar_names[] =
-    { "MainWindow", "ComposeWindow", "MessageWindow" };
+    { "MainWindow", "ComposeWindow", "ResendWindow", "MessageWindow" };
 
 /*
  * The BalsaToolbarModel class.
diff --git a/src/toolbar-factory.h b/src/toolbar-factory.h
index e307fed49..963d543f1 100644
--- a/src/toolbar-factory.h
+++ b/src/toolbar-factory.h
@@ -51,6 +51,7 @@ typedef struct {
 typedef enum {
     BALSA_TOOLBAR_TYPE_MAIN_WINDOW,
     BALSA_TOOLBAR_TYPE_COMPOSE_WINDOW,
+    BALSA_TOOLBAR_TYPE_RESEND_WINDOW,
     BALSA_TOOLBAR_TYPE_MESSAGE_WINDOW
 } BalsaToolbarType;
 
diff --git a/src/toolbar-prefs.c b/src/toolbar-prefs.c
index 800c7e8e7..cf9651c89 100644
--- a/src/toolbar-prefs.c
+++ b/src/toolbar-prefs.c
@@ -166,6 +166,15 @@ customize_dialog_cb(GtkWidget * widget, gpointer data)
     gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child,
                              gtk_label_new(_("Compose window")));
 
+    model = resend_window_get_toolbar_model();
+    group = g_simple_action_group_new();
+    sendmsg_window_add_action_entries(G_ACTION_MAP(group));
+    g_debug("%s: resend window", __func__);
+    child = create_toolbar_page(model, G_ACTION_MAP(group));
+    g_object_unref(group);
+    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child,
+                             gtk_label_new(_("Resend window")));
+
     model = message_window_get_toolbar_model();
     group = g_simple_action_group_new();
     message_window_add_action_entries(G_ACTION_MAP(group));
diff --git a/ui/resend-window.ui b/ui/resend-window.ui
index 81c8760f5..55a27f1cc 100644
--- a/ui/resend-window.ui
+++ b/ui/resend-window.ui
@@ -47,6 +47,13 @@
     </submenu>
     <submenu>
       <attribute name="label" translatable="yes">_Show</attribute>
+      <section>
+        <item>
+          <attribute name="label"
+            translatable="yes">Show Too_lbar</attribute>
+          <attribute name="action">win.show-toolbar</attribute>
+        </item>
+      </section>
       <section>
         <item>
           <attribute name="label"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]