[balsa] Various: Drop libbalsa_{radio,toggle}_activated
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Various: Drop libbalsa_{radio,toggle}_activated
- Date: Sun, 12 Jul 2020 19:02:15 +0000 (UTC)
commit c5392a32fa3784d129eb0c3ad3b2d533e5cd6f1f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Jul 12 14:57:25 2020 -0400
Various: Drop libbalsa_{radio,toggle}_activated
and replace them by NULL in GActionEntry structs.
https://developer.gnome.org/gio/stable/GActionMap.html#GActionEntry:
Since GLib 2.40, [activate] can be NULL for stateful actions, in which
case the default handler is used. For boolean-stated actions with
no parameter, this is a toggle. For other state types (and parameter
type equal to the state type) this will be a function that just calls
change_state…
which is exactly what our helpers did.
* libbalsa/application-helpers.c (libbalsa_window_add_accelerator):
* libbalsa/application-helpers.h:
* libbalsa/source-viewer.c (libbalsa_show_message_source):
* src/ab-main.c (get_main_menu):
* src/main-window.c:
* src/message-window.c:
* src/sendmsg-window.c:
ChangeLog | 19 +++++++++++++++
libbalsa/application-helpers.c | 44 ----------------------------------
libbalsa/application-helpers.h | 8 -------
libbalsa/source-viewer.c | 18 +++++++-------
src/ab-main.c | 3 +--
src/main-window.c | 54 ++++++++++++++----------------------------
src/message-window.c | 12 ++++------
src/sendmsg-window.c | 54 +++++++++++++++---------------------------
8 files changed, 69 insertions(+), 143 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 93762eae9..7646e80ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2020-07-12 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Various: Drop libbalsa_{radio,toggle}_activated
+
+ https://developer.gnome.org/gio/stable/GActionMap.html#GActionEntry:
+ Since GLib 2.40, [activate] can be NULL for stateful actions,
+ in which case the default handler is used. For boolean-stated
+ actions with no parameter, this is a toggle. For other state
+ types (and parameter type equal to the state type) this will be a
+ function that just calls change_state…
+
+ * libbalsa/application-helpers.c (libbalsa_window_add_accelerator):
+ * libbalsa/application-helpers.h:
+ * libbalsa/source-viewer.c (libbalsa_show_message_source):
+ * src/ab-main.c (get_main_menu):
+ * src/main-window.c:
+ * src/message-window.c:
+ * src/sendmsg-window.c:
+
2020-07-05 Peter Bloomfield <pbloomfield bellsouth net>
body: If a part with content-type "message/external-body" has
diff --git a/libbalsa/application-helpers.c b/libbalsa/application-helpers.c
index e352dba56..137f4eb2d 100644
--- a/libbalsa/application-helpers.c
+++ b/libbalsa/application-helpers.c
@@ -279,47 +279,3 @@ libbalsa_window_add_accelerator(GtkApplicationWindow * window,
closure);
gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
}
-
-/*
- * libbalsa_toggle_activated
- *
- * Callback for the "activated" signal of GAction with a boolean state
- * Toggle the action's state
- *
- * action the GAction
- * parameter not used
- * user_data not used
- */
-
-void
-libbalsa_toggle_activated(GSimpleAction * action,
- GVariant * parameter,
- gpointer user_data)
-{
- GVariant *action_state;
- gboolean state;
-
- action_state = g_action_get_state(G_ACTION(action));
- state = g_variant_get_boolean(action_state);
- g_action_change_state(G_ACTION(action), g_variant_new_boolean(!state));
- g_variant_unref(action_state);
-}
-
-/*
- * libbalsa_radio_activated
- *
- * Callback for the "activated" signal of GAction with a string state
- * Store the new state
- *
- * action the GAction
- * parameter the new state
- * user_data not used
- */
-
-void
-libbalsa_radio_activated(GSimpleAction * action,
- GVariant * parameter,
- gpointer user_data)
-{
- g_action_change_state(G_ACTION(action), parameter);
-}
diff --git a/libbalsa/application-helpers.h b/libbalsa/application-helpers.h
index a525e21bb..9d1b73669 100644
--- a/libbalsa/application-helpers.h
+++ b/libbalsa/application-helpers.h
@@ -47,12 +47,4 @@ void libbalsa_window_add_accelerator (GtkApplicationWindow * window,
const gchar * accel,
const gchar * action_name);
-void libbalsa_toggle_activated (GSimpleAction * action,
- GVariant * parameter,
- gpointer user_data);
-
-void libbalsa_radio_activated (GSimpleAction * action,
- GVariant * parameter,
- gpointer user_data);
-
#endif /* __LIBBALSA_APPLICATION_HELPERS_H__ */
diff --git a/libbalsa/source-viewer.c b/libbalsa/source-viewer.c
index 4c11da619..a80bf2fc4 100644
--- a/libbalsa/source-viewer.c
+++ b/libbalsa/source-viewer.c
@@ -152,12 +152,11 @@ lsv_escape_change_state(GSimpleAction * action,
g_simple_action_set_state(action, state);
}
-static GActionEntry win_entries[] = {
- {"lsv-close", lsv_close_activated},
- {"lsv-copy", lsv_copy_activated},
- {"lsv-select", lsv_select_activated},
- {"lsv-escape", libbalsa_toggle_activated, NULL, "false",
- lsv_escape_change_state}
+static GActionEntry entries[] = {
+ {"close", lsv_close_activated},
+ {"copy", lsv_copy_activated},
+ {"select", lsv_select_activated},
+ {"escape", NULL, NULL, "false", lsv_escape_change_state}
};
static void
@@ -222,8 +221,8 @@ libbalsa_show_message_source(GtkApplication * application,
geometry_manager_attach(GTK_WINDOW(window), "SourceView");
menu_bar = libbalsa_window_get_menu_bar(GTK_APPLICATION_WINDOW(window),
- win_entries,
- G_N_ELEMENTS(win_entries),
+ entries,
+ G_N_ELEMENTS(entries),
resource_path, &err, window);
if (!menu_bar) {
libbalsa_information(LIBBALSA_INFORMATION_WARNING,
@@ -253,8 +252,7 @@ libbalsa_show_message_source(GtkApplication * application,
gtk_widget_show_all(window);
- escape_action =
- g_action_map_lookup_action(G_ACTION_MAP(window), "lsv-escape");
+ escape_action = g_action_map_lookup_action(G_ACTION_MAP(window), "escape");
lsv_escape_change_state(G_SIMPLE_ACTION(escape_action),
g_variant_new_boolean(*escape_specials),
window);
diff --git a/src/ab-main.c b/src/ab-main.c
index 547df66e5..725291c5f 100644
--- a/src/ab-main.c
+++ b/src/ab-main.c
@@ -571,8 +571,7 @@ get_main_menu(GtkApplication * application)
{"entry-new", entry_new_activated},
{"entry-delete", entry_delete_activated},
{"help-about", help_about_activated},
- {"address-book", libbalsa_radio_activated, "s", "''",
- address_book_change_state},
+ {"address-book", NULL, "s", "''", address_book_change_state},
};
GtkBuilder *builder;
const gchar resource_path[] = "/org/desktop/BalsaAb/ab-main.ui";
diff --git a/src/main-window.c b/src/main-window.c
index 0a9a29f50..dd4a8380c 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -1993,22 +1993,14 @@ static GActionEntry win_entries[] = {
{"find-in-message", find_in_message_activated},
{"filters", filters_activated},
{"export-filters", export_filters_activated},
- {"show-mailbox-tree", libbalsa_toggle_activated, NULL, "false",
- show_mailbox_tree_change_state},
- {"show-mailbox-tabs", libbalsa_toggle_activated, NULL, "false",
- show_mailbox_tabs_change_state},
- {"show-toolbar", libbalsa_toggle_activated, NULL, "false",
- show_toolbar_change_state},
- {"show-statusbar", libbalsa_toggle_activated, NULL, "false",
- show_statusbar_change_state},
- {"show-sos-bar", libbalsa_toggle_activated, NULL, "false",
- show_sos_bar_change_state},
- {"wrap", libbalsa_toggle_activated, NULL, "false",
- wrap_change_state},
- {"headers", libbalsa_radio_activated, "s", "'none'",
- header_change_state},
- {"threading", libbalsa_toggle_activated, NULL, "false",
- threading_change_state},
+ {"show-mailbox-tree", NULL, NULL, "false", show_mailbox_tree_change_state},
+ {"show-mailbox-tabs", NULL, NULL, "false", show_mailbox_tabs_change_state},
+ {"show-toolbar", NULL, NULL, "false", show_toolbar_change_state},
+ {"show-statusbar", NULL, NULL, "false", show_statusbar_change_state},
+ {"show-sos-bar", NULL, NULL, "false", show_sos_bar_change_state},
+ {"wrap", NULL, NULL, "false", wrap_change_state},
+ {"headers", NULL, "s", "'none'", header_change_state},
+ {"threading", NULL, NULL, "false", threading_change_state},
{"expand-all", expand_all_activated},
{"collapse-all", collapse_all_activated},
#ifdef HAVE_HTML_WIDGET
@@ -2020,22 +2012,14 @@ static GActionEntry win_entries[] = {
{"previous-message", previous_message_activated},
{"next-unread", next_unread_activated},
{"next-flagged", next_flagged_activated},
- {"hide-deleted", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
- {"hide-undeleted", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
- {"hide-read", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
- {"hide-unread", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
- {"hide-flagged", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
- {"hide-unflagged", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
- {"hide-answered", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
- {"hide-unanswered", libbalsa_toggle_activated, NULL, "false",
- hide_change_state},
+ {"hide-deleted", NULL, NULL, "false", hide_change_state},
+ {"hide-undeleted", NULL, NULL, "false", hide_change_state},
+ {"hide-read", NULL, NULL, "false", hide_change_state},
+ {"hide-unread", NULL, NULL, "false", hide_change_state},
+ {"hide-flagged", NULL, NULL, "false", hide_change_state},
+ {"hide-unflagged", NULL, NULL, "false", hide_change_state},
+ {"hide-answered", NULL, NULL, "false", hide_change_state},
+ {"hide-unanswered", NULL, NULL, "false", hide_change_state},
{"reset-filter", reset_filter_activated},
{"mailbox-select-all", mailbox_select_all_activated},
{"mailbox-edit", mailbox_edit_activated},
@@ -2065,10 +2049,8 @@ static GActionEntry win_entries[] = {
{"toggle-answered", toggle_answered_activated},
{"store-address", store_address_activated},
/* toolbar actions that are not in any menu: */
- {"show-all-headers", libbalsa_toggle_activated, NULL, "false",
- show_all_headers_change_state},
- {"show-preview-pane", libbalsa_toggle_activated, NULL, "true",
- show_preview_pane_change_state},
+ {"show-all-headers", NULL, NULL, "false", show_all_headers_change_state},
+ {"show-preview-pane", NULL, NULL, "true", show_preview_pane_change_state},
};
static void
diff --git a/src/message-window.c b/src/message-window.c
index 5eacd8b75..933774c3c 100644
--- a/src/message-window.c
+++ b/src/message-window.c
@@ -770,12 +770,9 @@ static GActionEntry win_entries[] = {
{"close", mw_close_activated},
{"select-all", mw_select_text_activated},
{"find-in-message", mw_find_in_message_activated},
- {"show-toolbar", libbalsa_toggle_activated, NULL, "false",
- mw_show_toolbar_change_state},
- {"wrap", libbalsa_toggle_activated, NULL, "false",
- mw_wrap_change_state},
- {"headers", libbalsa_radio_activated, "s", "'none'",
- mw_header_change_state},
+ {"show-toolbar", NULL, NULL, "false", mw_show_toolbar_change_state},
+ {"wrap", NULL, NULL, "false", mw_wrap_change_state},
+ {"headers", NULL, "s", "'none'", mw_header_change_state},
#ifdef HAVE_HTML_WIDGET
{"zoom-in", mw_zoom_in_activated},
{"zoom-out", mw_zoom_out_activated},
@@ -798,8 +795,7 @@ static GActionEntry win_entries[] = {
{"select-text", mw_select_text_activated},
{"move-to-trash", mw_move_to_trash_activated},
/* Only a toolbar button: */
- {"show-all-headers", libbalsa_toggle_activated, NULL, "false",
- mw_show_all_headers_change_state}
+ {"show-all-headers", NULL, NULL, "false", mw_show_all_headers_change_state}
};
void
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index f15a142b8..0f2e09aac 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -6748,43 +6748,27 @@ static GActionEntry win_entries[] = {
{"insert-sig", sw_insert_sig_activated },
{"quote", sw_quote_activated },
#if HAVE_GSPELL || HAVE_GTKSPELL
- {"spell-check", libbalsa_toggle_activated, NULL, "false",
- sw_spell_check_change_state },
+ {"spell-check", NULL, NULL, "false", sw_spell_check_change_state},
#else /* HAVE_GTKSPELL */
- {"spell-check", sw_spell_check_activated },
+ {"spell-check", sw_spell_check_activated },
#endif /* HAVE_GTKSPELL */
- {"select-ident", sw_select_ident_activated },
- {"edit", sw_edit_activated },
- {"show-toolbar", libbalsa_toggle_activated, NULL, "false",
- sw_show_toolbar_change_state },
- {"from", libbalsa_toggle_activated, NULL, "false",
- sw_from_change_state },
- {"recips", libbalsa_toggle_activated, NULL, "false",
- sw_recips_change_state },
- {"reply-to", libbalsa_toggle_activated, NULL, "false",
- sw_reply_to_change_state },
- {"fcc", libbalsa_toggle_activated, NULL, "false",
- sw_fcc_change_state },
- {"request-mdn", libbalsa_toggle_activated, NULL, "false",
- sw_request_mdn_change_state },
- {"request-dsn", libbalsa_toggle_activated, NULL, "false",
- sw_request_dsn_change_state },
- {"flowed", libbalsa_toggle_activated, NULL, "false",
- sw_flowed_change_state },
- {"send-html", libbalsa_toggle_activated, NULL, "false",
- sw_send_html_change_state },
- {"sign", libbalsa_toggle_activated, NULL, "false",
- sw_sign_change_state },
- {"encrypt", libbalsa_toggle_activated, NULL, "false",
- sw_encrypt_change_state },
- {"gpg-mode", libbalsa_radio_activated, "s", "'mime'",
- sw_gpg_mode_change_state },
- {"gpg-mode", libbalsa_radio_activated, "s", "'open-pgp'",
- sw_gpg_mode_change_state },
- {"gpg-mode", libbalsa_radio_activated, "s", "'smime'",
- sw_gpg_mode_change_state },
- {"attpubkey", libbalsa_toggle_activated, NULL, "false",
- sw_att_pubkey_change_state },
+ {"select-ident", sw_select_ident_activated },
+ {"edit", sw_edit_activated },
+ {"show-toolbar", NULL, NULL, "false", sw_show_toolbar_change_state},
+ {"from", NULL, NULL, "false", sw_from_change_state },
+ {"recips", NULL, NULL, "false", sw_recips_change_state },
+ {"reply-to", NULL, NULL, "false", sw_reply_to_change_state },
+ {"fcc", NULL, NULL, "false", sw_fcc_change_state },
+ {"request-mdn", NULL, NULL, "false", sw_request_mdn_change_state },
+ {"request-dsn", NULL, NULL, "false", sw_request_dsn_change_state },
+ {"flowed", NULL, NULL, "false", sw_flowed_change_state },
+ {"send-html", NULL, NULL, "false", sw_send_html_change_state },
+ {"sign", NULL, NULL, "false", sw_sign_change_state },
+ {"encrypt", NULL, NULL, "false", sw_encrypt_change_state },
+ {"gpg-mode", NULL, "s", "'mime'", sw_gpg_mode_change_state },
+ {"gpg-mode", NULL, "s", "'open-pgp'", sw_gpg_mode_change_state },
+ {"gpg-mode", NULL, "s", "'smime'", sw_gpg_mode_change_state },
+ {"attpubkey", NULL, NULL, "false", sw_att_pubkey_change_state },
/* Only a toolbar button: */
{"toolbar-send", sw_toolbar_send_activated }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]