[balsa/popover: 9/20] Various: Adapt to MRU menu changes
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/popover: 9/20] Various: Adapt to MRU menu changes
- Date: Sun, 10 May 2020 20:11:17 +0000 (UTC)
commit 1e3a7af7ae07908b5f1f9d4ea7e8f6723bb6c5b0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue May 5 10:54:43 2020 -0400
Various: Adapt to MRU menu changes
src/balsa-index.c | 25 ++++++++++++++-----------
src/balsa-message.c | 12 ++++++++----
src/balsa-mime-widget-message.c | 18 ++++++++++++------
src/message-window.c | 13 ++++++++-----
4 files changed, 42 insertions(+), 26 deletions(-)
---
diff --git a/src/balsa-index.c b/src/balsa-index.c
index cdc422084..a7dc38335 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -1934,14 +1934,19 @@ move_to_change_state(GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- BalsaIndex *index = user_data;
- const gchar *url = g_variant_get_string(parameter, NULL);
- LibBalsaMailbox *mailbox = balsa_find_mailbox_by_url(url);
-
- if (balsa_mailbox_node_get_mailbox(index->mailbox_node) != mailbox) {
- GArray *selected = balsa_index_selected_msgnos_new(index);
- balsa_index_transfer(index, selected, mailbox, FALSE);
- balsa_index_selected_msgnos_free(index, selected);
+ BalsaIndex *bindex = user_data;
+ LibBalsaMailbox *mailbox;
+
+ mailbox =
+ balsa_mblist_mru_get_mailbox_from_variant(parameter, GTK_WIDGET(bindex));
+
+ if (mailbox != NULL) {
+ balsa_mblist_mru_add(&balsa_app.folder_mru, libbalsa_mailbox_get_url(mailbox));
+ if (mailbox != balsa_mailbox_node_get_mailbox(bindex->mailbox_node)) {
+ GArray *selected = balsa_index_selected_msgnos_new(bindex);
+ balsa_index_transfer(bindex, selected, mailbox, FALSE);
+ balsa_index_selected_msgnos_free(bindex, selected);
+ }
}
}
@@ -2006,9 +2011,7 @@ bndx_do_popup(BalsaIndex * index, GdkEventButton * event)
g_object_unref(simple);
mru_menu =
- balsa_mblist_mru_menu(GTK_WINDOW
- (gtk_widget_get_toplevel(GTK_WIDGET(index))),
- &balsa_app.folder_mru, "bndx-popup.move-to");
+ balsa_mblist_mru_menu(&balsa_app.folder_mru, "bndx-popup.move-to");
submenu = gtk_menu_new_from_model(G_MENU_MODEL(mru_menu));
g_object_unref(mru_menu);
diff --git a/src/balsa-message.c b/src/balsa-message.c
index ae82803d5..5b02c041f 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -1620,10 +1620,15 @@ copy_part_change_state(GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- const gchar *url = g_variant_get_string(parameter, NULL);
BalsaPartInfo *info = user_data;
+ const gchar *url;
- balsa_message_copy_part(url, info->body);
+ url = balsa_mblist_mru_get_url_from_variant(parameter, info->popup_menu);
+
+ if (url[0] != '\0') {
+ balsa_mblist_mru_add(&balsa_app.folder_mru, url);
+ balsa_message_copy_part(url, info->body);
+ }
g_simple_action_set_state(action, parameter);
}
@@ -1669,8 +1674,7 @@ part_create_menu(BalsaMessage *balsa_message, BalsaPartInfo *info)
GMenu *submenu;
submenu =
- balsa_mblist_mru_menu(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(balsa_message))),
- &balsa_app.folder_mru, "part-menu.copy-part");
+ balsa_mblist_mru_menu(&balsa_app.folder_mru, "part-menu.copy-part");
g_menu_append_submenu(menu, _("_Copy to folder…"), G_MENU_MODEL(submenu));
}
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index 4b23b588d..ee0f7747d 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -451,15 +451,20 @@ copy_change_state(GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- const gchar *url = g_variant_get_string(parameter, NULL);
LibBalsaMessageBody *part = user_data;
+ const gchar *url =
+ balsa_mblist_mru_get_url_from_variant(parameter, part->user_data);
- balsa_message_copy_part(url, part);
+ if (url[0] != '\0') {
+ balsa_mblist_mru_add(&balsa_app.folder_mru, url);
+ balsa_message_copy_part(url, part);
+ }
}
static void
bm_header_extend_popup(GtkWidget * widget, GtkMenu * menu, gpointer arg)
{
+ LibBalsaMessageBody *part = arg;
GSimpleActionGroup *simple;
static const GActionEntry header_popup_entries[] = {
{"copy", libbalsa_radio_activated, "s", "''", copy_change_state},
@@ -468,12 +473,14 @@ bm_header_extend_popup(GtkWidget * widget, GtkMenu * menu, gpointer arg)
GtkWidget *menu_item, *submenu;
GtkWidget *separator = gtk_separator_menu_item_new();
+ part->user_data = widget;
+
gtk_menu_shell_append(GTK_MENU_SHELL(menu), separator);
gtk_widget_show(separator);
menu_item = gtk_menu_item_new_with_label(_("Reply…"));
g_signal_connect(menu_item, "activate",
G_CALLBACK(bm_header_ctx_menu_reply),
- arg);
+ part);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
gtk_widget_show(menu_item);
@@ -481,15 +488,14 @@ bm_header_extend_popup(GtkWidget * widget, GtkMenu * menu, gpointer arg)
g_action_map_add_action_entries(G_ACTION_MAP(simple),
header_popup_entries,
G_N_ELEMENTS(header_popup_entries),
- arg);
+ part);
gtk_widget_insert_action_group(widget,
"header-popup",
G_ACTION_GROUP(simple));
g_object_unref(simple);
mru_menu =
- balsa_mblist_mru_menu(GTK_WINDOW(gtk_widget_get_toplevel(widget)),
- &balsa_app.folder_mru, "header-popup.copy");
+ balsa_mblist_mru_menu(&balsa_app.folder_mru, "header-popup.copy");
submenu = gtk_menu_new_from_model(G_MENU_MODEL(mru_menu));
g_object_unref(mru_menu);
diff --git a/src/message-window.c b/src/message-window.c
index fdf587ae9..719b1f5ef 100644
--- a/src/message-window.c
+++ b/src/message-window.c
@@ -804,10 +804,14 @@ move_to_change_state(GSimpleAction *action,
gpointer user_data)
{
MessageWindow *mw = user_data;
- const gchar *url = g_variant_get_string(parameter, NULL);
- LibBalsaMailbox *mailbox = balsa_find_mailbox_by_url(url);
+ LibBalsaMailbox *mailbox;
+
+ mailbox = balsa_mblist_mru_get_mailbox_from_variant(parameter, mw->window);
- message_window_move_message(mw, mailbox);
+ if (mailbox != NULL) {
+ balsa_mblist_mru_add(&balsa_app.folder_mru, libbalsa_mailbox_get_url(mailbox));
+ message_window_move_message(mw, mailbox);
+ }
}
void
@@ -906,8 +910,7 @@ message_window_new(LibBalsaMailbox * mailbox, guint msgno)
g_object_unref(simple);
mru_menu =
- balsa_mblist_mru_menu(GTK_WINDOW(window),
- &balsa_app.folder_mru, "message-window.move-to");
+ balsa_mblist_mru_menu(&balsa_app.folder_mru, "message-window.move-to");
submenu = gtk_menu_new_from_model(G_MENU_MODEL(mru_menu));
g_object_unref(mru_menu);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]