Version in base suite: 3.56.1-1 Version in overlay suite: 3.56.1-1+deb13u1 Base version: evolution_3.56.1-1+deb13u1 Target version: evolution_3.56.2-0+deb13u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/e/evolution/evolution_3.56.1-1+deb13u1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/e/evolution/evolution_3.56.2-0+deb13u1.dsc CMakeLists.txt | 2 NEWS | 12 ++ debian/changelog | 13 ++ debian/control | 16 +- src/e-util/e-attachment.c | 2 src/e-util/e-headerbar-button.c | 8 - src/e-util/e-menu-tool-button.c | 53 ++++++++- src/e-util/e-menu-tool-button.h | 6 + src/e-util/e-ui-customize-dialog.c | 22 +++ src/e-util/e-ui-parser.c | 24 ++++ src/e-util/e-ui-parser.h | 2 src/em-format/e-mail-formatter-attachment.c | 2 src/em-format/e-mail-parser-multipart-alternative.c | 2 src/libemail-engine/e-mail-session-utils.c | 5 src/libemail-engine/mail-ops.c | 5 src/mail/e-mail-reader.c | 6 - src/modules/calendar/e-cal-shell-view-actions.c | 2 src/shell/e-shell-view.c | 114 +++++++++++++++++++- 18 files changed, 271 insertions(+), 25 deletions(-) diff -Nru evolution-3.56.1/CMakeLists.txt evolution-3.56.2/CMakeLists.txt --- evolution-3.56.1/CMakeLists.txt 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/CMakeLists.txt 2025-05-23 18:29:06.000000000 +0000 @@ -4,7 +4,7 @@ cmake_policy(VERSION 3.15) project(evolution - VERSION 3.56.1 + VERSION 3.56.2 LANGUAGES C) set(PROJECT_BUGREPORT "https://gitlab.gnome.org/GNOME/evolution/issues/") set(PROJECT_URL "https://gitlab.gnome.org/GNOME/evolution/-/wikis/home") diff -Nru evolution-3.56.1/NEWS evolution-3.56.2/NEWS --- evolution-3.56.1/NEWS 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/NEWS 2025-05-23 18:29:06.000000000 +0000 @@ -1,3 +1,15 @@ +Evolution 3.56.2 2025-05-23 +--------------------------- + +Bug Fixes: + I#3042 - Check return value of CamelDataWrapper calculate size functions + I#3045 - Cannot add actions in 'Customize User Interface' dialog + I#3052 - Ensure "New" button action in Calendar view + I#3061 - Mail: Do not strip signature for Edit as New in Sent folder + +Miscellaneous: + Calendar: Cannot show/hide Tasks and Memos pane + Evolution 3.56.1 2025-04-11 --------------------------- diff -Nru evolution-3.56.1/debian/changelog evolution-3.56.2/debian/changelog --- evolution-3.56.1/debian/changelog 2025-10-27 14:03:31.000000000 +0000 +++ evolution-3.56.2/debian/changelog 2025-11-06 03:13:06.000000000 +0000 @@ -1,3 +1,16 @@ +evolution (3.56.2-0+deb13u1) trixie; urgency=medium + + * New upstream bugfix release, fixing these issues: + - I#3042 - Check return value of CamelDataWrapper calculate size functions + - I#3045 - Cannot add actions in 'Customize User Interface' dialog + - I#3052 - Ensure "New" button action in Calendar view + - I#3061 - Mail: Do not strip signature for Edit as New in Sent folder + - Calendar: Cannot show/hide Tasks and Memos pane + - (Closes: #1120149) + * debian/control: Bump e-d-s dependencies and build-dependencies to 3.56.2 + + -- Jeremy BĂ­cha Wed, 05 Nov 2025 22:13:06 -0500 + evolution (3.56.1-1+deb13u1) trixie-security; urgency=medium * Cherry-pick patch to fix crash with webkit2gtk 2.50 (Closes: #1116301) diff -Nru evolution-3.56.1/debian/control evolution-3.56.2/debian/control --- evolution-3.56.1/debian/control 2025-10-27 14:03:31.000000000 +0000 +++ evolution-3.56.2/debian/control 2025-11-06 03:13:06.000000000 +0000 @@ -12,14 +12,14 @@ libgtk-3-dev (>= 3.10.0), libgail-3-dev (>= 3.0.2), libgdk-pixbuf-2.0-dev (>= 2.24.0), - libcamel1.2-dev (>= 3.56.1), + libcamel1.2-dev (>= 3.56.2), libcmark-dev, - libebook1.2-dev (>= 3.56.1), - libecal2.0-dev (>= 3.56.1), - libedataserver1.2-dev (>= 3.56.1), - libedataserverui1.2-dev (>= 3.56.1), - libebackend1.2-dev (>= 3.56.1), - evolution-data-server-dev (>= 3.56.1), + libebook1.2-dev (>= 3.56.2), + libecal2.0-dev (>= 3.56.2), + libedataserver1.2-dev (>= 3.56.2), + libedataserverui1.2-dev (>= 3.56.2), + libebackend1.2-dev (>= 3.56.2), + evolution-data-server-dev (>= 3.56.2), evolution-data-server-dev (<< 3.57), libwebkit2gtk-4.1-dev, libgeocode-glib-dev (>= 3.26.3), @@ -68,7 +68,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, evolution-common (= ${source:Version}), - evolution-data-server (>= 3.56.1), + evolution-data-server (>= 3.56.2), evolution-data-server (<< 3.57), default-dbus-system-bus | dbus-system-bus, psmisc diff -Nru evolution-3.56.1/src/e-util/e-attachment.c evolution-3.56.2/src/e-util/e-attachment.c --- evolution-3.56.1/src/e-util/e-attachment.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/e-util/e-attachment.c 2025-05-23 18:29:06.000000000 +0000 @@ -2546,7 +2546,7 @@ dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part)); /* this actually downloads the part and makes it available later */ bytes_written = camel_data_wrapper_calculate_decoded_size_sync (dw, attachment->priv->cancellable, NULL); - g_file_info_set_size (file_info, bytes_written); + g_file_info_set_size (file_info, bytes_written != ((gsize) -1) ? bytes_written : 0); attachment_load_finish_common (attachment, mime_part, file_info); diff -Nru evolution-3.56.1/src/e-util/e-headerbar-button.c evolution-3.56.2/src/e-util/e-headerbar-button.c --- evolution-3.56.1/src/e-util/e-headerbar-button.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/e-util/e-headerbar-button.c 2025-05-23 18:29:06.000000000 +0000 @@ -95,9 +95,8 @@ { EUIAction *action; - if (header_bar_button->priv->action == NULL) - action = header_bar_button_get_prefer_action (header_bar_button); - else + action = header_bar_button_get_prefer_action (header_bar_button); + if (!action) action = header_bar_button->priv->action; if (action != NULL) { @@ -243,6 +242,7 @@ case PROP_ACTION: g_clear_object (&header_bar_button->priv->action); header_bar_button->priv->action = g_value_dup_object (value); + header_bar_button_update_button (header_bar_button); return; case PROP_UI_MANAGER: g_clear_object (&header_bar_button->priv->ui_manager); @@ -361,7 +361,7 @@ "Action", "Button action", E_TYPE_UI_ACTION, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE)); g_object_class_install_property ( object_class, diff -Nru evolution-3.56.1/src/e-util/e-menu-tool-button.c evolution-3.56.2/src/e-util/e-menu-tool-button.c --- evolution-3.56.1/src/e-util/e-menu-tool-button.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/e-util/e-menu-tool-button.c 2025-05-23 18:29:06.000000000 +0000 @@ -27,13 +27,15 @@ struct _EMenuToolButtonPrivate { gchar *prefer_item; + EUIAction *fallback_action; EUIManager *ui_manager; }; enum { PROP_0, PROP_PREFER_ITEM, - PROP_UI_MANAGER + PROP_UI_MANAGER, + PROP_FALLBACK_ACTION }; G_DEFINE_TYPE_WITH_PRIVATE (EMenuToolButton, e_menu_tool_button, GTK_TYPE_MENU_TOOL_BUTTON) @@ -55,7 +57,8 @@ gchar *label; action = menu_tool_button_get_prefer_item_action (self); - + if (!action) + action = self->priv->fallback_action; if (!action) return; @@ -86,6 +89,12 @@ g_clear_object (&E_MENU_TOOL_BUTTON (object)->priv->ui_manager); E_MENU_TOOL_BUTTON (object)->priv->ui_manager = g_value_dup_object (value); return; + + case PROP_FALLBACK_ACTION: + e_menu_tool_button_set_fallback_action ( + E_MENU_TOOL_BUTTON (object), + g_value_get_object (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -107,6 +116,10 @@ case PROP_UI_MANAGER: g_value_set_object (value, E_MENU_TOOL_BUTTON (object)->priv->ui_manager); return; + + case PROP_FALLBACK_ACTION: + g_value_set_object (value, e_menu_tool_button_get_fallback_action (E_MENU_TOOL_BUTTON (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -117,6 +130,7 @@ { EMenuToolButton *self = E_MENU_TOOL_BUTTON (object); + g_clear_object (&self->priv->fallback_action); g_clear_object (&self->priv->ui_manager); g_free (self->priv->prefer_item); @@ -153,6 +167,16 @@ NULL, E_TYPE_UI_MANAGER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property ( + object_class, + PROP_FALLBACK_ACTION, + g_param_spec_object ( + "fallback-action", + NULL, + NULL, + E_TYPE_UI_ACTION, + G_PARAM_READWRITE)); } static void @@ -201,3 +225,28 @@ g_object_notify (G_OBJECT (button), "prefer-item"); } + +EUIAction * +e_menu_tool_button_get_fallback_action (EMenuToolButton *button) +{ + g_return_val_if_fail (E_IS_MENU_TOOL_BUTTON (button), NULL); + + return button->priv->fallback_action; +} + +void +e_menu_tool_button_set_fallback_action (EMenuToolButton *button, + EUIAction *action) +{ + g_return_if_fail (E_IS_MENU_TOOL_BUTTON (button)); + + if (button->priv->fallback_action == action) + return; + + g_clear_object (&button->priv->fallback_action); + button->priv->fallback_action = action ? g_object_ref (action) : NULL; + + menu_tool_button_update_button (button); + + g_object_notify (G_OBJECT (button), "fallback-action"); +} diff -Nru evolution-3.56.1/src/e-util/e-menu-tool-button.h evolution-3.56.2/src/e-util/e-menu-tool-button.h --- evolution-3.56.1/src/e-util/e-menu-tool-button.h 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/e-util/e-menu-tool-button.h 2025-05-23 18:29:06.000000000 +0000 @@ -31,6 +31,7 @@ #include +#include #include /* Standard GObject macros */ @@ -75,6 +76,11 @@ void e_menu_tool_button_set_prefer_item (EMenuToolButton *button, const gchar *prefer_item); +EUIAction * e_menu_tool_button_get_fallback_action + (EMenuToolButton *button); +void e_menu_tool_button_set_fallback_action + (EMenuToolButton *button, + EUIAction *action); G_END_DECLS diff -Nru evolution-3.56.1/src/e-util/e-ui-customize-dialog.c evolution-3.56.2/src/e-util/e-ui-customize-dialog.c --- evolution-3.56.1/src/e-util/e-ui-customize-dialog.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/e-util/e-ui-customize-dialog.c 2025-05-23 18:29:06.000000000 +0000 @@ -77,7 +77,8 @@ }; enum { - COL_ACTIONS_NAME_STR = 0, + COL_ACTIONS_ELEM_OBJ = 0, + COL_ACTIONS_NAME_STR, COL_ACTIONS_LABEL_STR, COL_ACTIONS_TOOLTIP_STR, COL_ACTIONS_MARKUP_STR, @@ -1366,17 +1367,20 @@ GtkTreeIter action_iter; if (gtk_tree_model_get_iter (actions_model, &action_iter, path)) { + EUIElement *elem = NULL; gchar *label = NULL; gtk_tree_model_get (actions_model, &action_iter, + COL_ACTIONS_ELEM_OBJ, &elem, COL_ACTIONS_LABEL_STR, &label, -1); - if (label) { + if (elem) { GtkTreeIter store_iter; gtk_tree_store_insert (tree_store, &store_iter, parent, position); gtk_tree_store_set (tree_store, &store_iter, + COL_LAYOUT_ELEM_OBJ, elem, COL_LAYOUT_LABEL_STR, label, COL_LAYOUT_CAN_DRAG_BOOL, TRUE, -1); @@ -1387,6 +1391,7 @@ changed = TRUE; } + e_ui_element_free (elem); g_free (label); } } @@ -2550,6 +2555,7 @@ gtk_box_pack_start (box1, scrolled_window, TRUE, TRUE, 0); list_store = gtk_list_store_new (N_COL_ACTIONS, + E_TYPE_UI_ELEMENT, /* COL_ACTIONS_ELEM_OBJ */ G_TYPE_STRING, /* COL_ACTIONS_NAME_STR */ G_TYPE_STRING, /* COL_ACTIONS_LABEL_STR */ G_TYPE_STRING, /* COL_ACTIONS_TOOLTIP_STR */ @@ -3197,11 +3203,19 @@ for (ii = 0; ii < all_actions->len; ii++) { EUIAction *action = g_ptr_array_index (all_actions, ii); + EUIElement *elem; gchar *label; gchar *markup; const gchar *name, *tooltip; + gboolean is_new_elem = FALSE; name = g_action_get_name (G_ACTION (action)); + elem = g_hash_table_lookup (elements, name); + if (!elem) { + elem = e_ui_element_new_for_action (action); + is_new_elem = TRUE; + } + label = e_str_without_underscores (e_ui_action_get_label (action)); tooltip = e_ui_action_get_tooltip (action); if (!tooltip) @@ -3210,6 +3224,7 @@ gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, + COL_ACTIONS_ELEM_OBJ, elem, COL_ACTIONS_NAME_STR, name, COL_ACTIONS_MARKUP_STR, markup, COL_ACTIONS_LABEL_STR, label, @@ -3220,6 +3235,9 @@ g_free (label); g_free (markup); + + if (is_new_elem) + e_ui_element_free (elem); } gtk_tree_view_set_model (self->actions_tree_view, GTK_TREE_MODEL (list_store)); diff -Nru evolution-3.56.1/src/e-util/e-ui-parser.c evolution-3.56.2/src/e-util/e-ui-parser.c --- evolution-3.56.1/src/e-util/e-ui-parser.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/e-util/e-ui-parser.c 2025-05-23 18:29:06.000000000 +0000 @@ -9,6 +9,7 @@ #include #include "e-misc-utils.h" +#include "e-ui-action.h" #include "e-util-enums.h" #include "e-ui-parser.h" @@ -271,6 +272,29 @@ } /** + * e_ui_element_new_for_action: + * @action: an #EUIAction + * + * Creates a new #EUIElement referencing the @action. + * + * Returns: (transfer full): a new #EUIElement referencing the @action + * + * Since: 3.56.2 + **/ +EUIElement * +e_ui_element_new_for_action (EUIAction *action) +{ + EUIElement *elem; + + g_return_val_if_fail (E_IS_UI_ACTION (action), NULL); + + elem = e_ui_element_new (E_UI_ELEMENT_KIND_ITEM, NULL); + elem->data.item.action = e_util_strdup_strip (g_action_get_name (G_ACTION (action))); + + return elem; +} + +/** * e_ui_element_add_child: * @self: an #EUIElement to add the child to * @child: (transfer full): the child to add diff -Nru evolution-3.56.1/src/e-util/e-ui-parser.h evolution-3.56.2/src/e-util/e-ui-parser.h --- evolution-3.56.1/src/e-util/e-ui-parser.h 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/e-util/e-ui-parser.h 2025-05-23 18:29:06.000000000 +0000 @@ -12,6 +12,7 @@ #include +#include #include G_BEGIN_DECLS @@ -27,6 +28,7 @@ EUIElement * e_ui_element_copy (const EUIElement *src); void e_ui_element_free (EUIElement *self); EUIElement * e_ui_element_new_separator (void); +EUIElement * e_ui_element_new_for_action (EUIAction *action); void e_ui_element_add_child (EUIElement *self, EUIElement *child); gboolean e_ui_element_remove_child (EUIElement *self, diff -Nru evolution-3.56.1/src/em-format/e-mail-formatter-attachment.c evolution-3.56.2/src/em-format/e-mail-formatter-attachment.c --- evolution-3.56.1/src/em-format/e-mail-formatter-attachment.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/em-format/e-mail-formatter-attachment.c 2025-05-23 18:29:06.000000000 +0000 @@ -221,7 +221,7 @@ part_size = camel_data_wrapper_calculate_decoded_size_sync (CAMEL_DATA_WRAPPER (mime_part), cancellable, NULL); part_too_large = part_size > 1024 * size_limit; - if (part_too_large) { + if (part_too_large && part_size != ((gsize) -1)) { EAttachment *attachment; e_mail_part_attachment_set_expandable (empa, FALSE); diff -Nru evolution-3.56.1/src/em-format/e-mail-parser-multipart-alternative.c evolution-3.56.2/src/em-format/e-mail-parser-multipart-alternative.c --- evolution-3.56.1/src/em-format/e-mail-parser-multipart-alternative.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/em-format/e-mail-parser-multipart-alternative.c 2025-05-23 18:29:06.000000000 +0000 @@ -95,7 +95,7 @@ data_wrapper = camel_medium_get_content (CAMEL_MEDIUM (mpart)); content_size = camel_data_wrapper_calculate_decoded_size_sync (data_wrapper, cancellable, NULL); - if (content_size == 0) + if (content_size == 0 || content_size == ((gsize) -1)) continue; type = camel_mime_part_get_content_type (mpart); diff -Nru evolution-3.56.1/src/libemail-engine/e-mail-session-utils.c evolution-3.56.2/src/libemail-engine/e-mail-session-utils.c --- evolution-3.56.1/src/libemail-engine/e-mail-session-utils.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/libemail-engine/e-mail-session-utils.c 2025-05-23 18:29:06.000000000 +0000 @@ -808,6 +808,7 @@ CamelNameValueArray *xev_headers; const gchar *resent_from; gboolean request_dsn; + gsize msg_size; guint ii, len; GError *error = NULL; @@ -892,7 +893,9 @@ info = camel_message_info_new_from_headers (NULL, camel_medium_get_headers (CAMEL_MEDIUM (message))); - camel_message_info_set_size (info, camel_data_wrapper_calculate_size_sync (CAMEL_DATA_WRAPPER (message), cancellable, NULL)); + msg_size = camel_data_wrapper_calculate_size_sync (CAMEL_DATA_WRAPPER (message), cancellable, NULL); + if (msg_size != ((gsize) -1)) + camel_message_info_set_size (info, msg_size); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN | (camel_mime_message_has_attachment (message) ? CAMEL_MESSAGE_ATTACHMENTS : 0), ~0); diff -Nru evolution-3.56.1/src/libemail-engine/mail-ops.c evolution-3.56.2/src/libemail-engine/mail-ops.c --- evolution-3.56.1/src/libemail-engine/mail-ops.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/libemail-engine/mail-ops.c 2025-05-23 18:29:06.000000000 +0000 @@ -587,6 +587,7 @@ CamelNameValueArray *xev_headers = NULL; CamelMimeMessage *message; gint i; + gsize msg_size; guint jj, len; GError *local_error = NULL; gboolean did_connect = FALSE; @@ -691,7 +692,9 @@ /* Now check for posting, failures are ignored */ info = camel_message_info_new_from_headers (NULL, camel_medium_get_headers (CAMEL_MEDIUM (message))); - camel_message_info_set_size (info, camel_data_wrapper_calculate_size_sync (CAMEL_DATA_WRAPPER (message), cancellable, NULL)); + msg_size = camel_data_wrapper_calculate_size_sync (CAMEL_DATA_WRAPPER (message), cancellable, NULL); + if (msg_size != ((gsize) -1)) + camel_message_info_set_size (info, msg_size); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN | (camel_mime_message_has_attachment (message) ? CAMEL_MESSAGE_ATTACHMENTS : 0), ~0); diff -Nru evolution-3.56.1/src/mail/e-mail-reader.c evolution-3.56.2/src/mail/e-mail-reader.c --- evolution-3.56.1/src/mail/e-mail-reader.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/mail/e-mail-reader.c 2025-05-23 18:29:06.000000000 +0000 @@ -1211,6 +1211,7 @@ CamelFolder *folder; GPtrArray *uids; gboolean replace; + gboolean keep_signature; uids = e_mail_reader_get_selected_uids (reader); g_return_if_fail (uids != NULL); @@ -1221,7 +1222,10 @@ folder = e_mail_reader_ref_folder (reader); replace = em_utils_folder_is_drafts (registry, folder); - e_mail_reader_edit_messages (reader, folder, uids, replace, replace); + keep_signature = replace || + em_utils_folder_is_sent (registry, folder) || + em_utils_folder_is_outbox (registry, folder); + e_mail_reader_edit_messages (reader, folder, uids, replace, keep_signature); g_clear_object (&folder); g_ptr_array_unref (uids); diff -Nru evolution-3.56.1/src/modules/calendar/e-cal-shell-view-actions.c evolution-3.56.2/src/modules/calendar/e-cal-shell-view-actions.c --- evolution-3.56.1/src/modules/calendar/e-cal-shell-view-actions.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/modules/calendar/e-cal-shell-view-actions.c 2025-05-23 18:29:06.000000000 +0000 @@ -1327,7 +1327,7 @@ g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); - e_cal_shell_content_set_show_tag_vpane (cal_shell_view->priv->cal_shell_content, e_ui_action_get_active (action)); + e_cal_shell_content_set_show_tag_vpane (cal_shell_view->priv->cal_shell_content, !e_ui_action_get_active (action)); } void diff -Nru evolution-3.56.1/src/shell/e-shell-view.c evolution-3.56.2/src/shell/e-shell-view.c --- evolution-3.56.1/src/shell/e-shell-view.c 2025-04-11 06:24:18.000000000 +0000 +++ evolution-3.56.2/src/shell/e-shell-view.c 2025-05-23 18:29:06.000000000 +0000 @@ -1364,6 +1364,105 @@ } } +static EUIAction * +shell_view_get_new_menu_first_action (GMenuModel *new_menu, + EUIManager *manager) +{ + EUIAction *action = NULL; + gint ii, n_items; + + if (!new_menu) + return NULL; + + n_items = g_menu_model_get_n_items (new_menu); + + for (ii = 0; ii < n_items && !action; ii++) { + GVariant *value; + + value = g_menu_model_get_item_attribute_value (new_menu, ii, G_MENU_ATTRIBUTE_ACTION, G_VARIANT_TYPE_STRING); + if (value) { + const gchar *action_full_name = g_variant_get_string (value, NULL); + + if (action_full_name) { + action = e_ui_manager_get_action (manager, action_full_name); + + if (!action) { + const gchar *dot = strchr (action_full_name, '.'); + + if (dot) + action = e_ui_manager_get_action (manager, dot + 1); + } + } + } + + g_clear_pointer (&value, g_variant_unref); + + if (!action) { + GMenuLinkIter *iter; + + iter = g_menu_model_iterate_item_links (new_menu, ii); + if (iter) { + GMenuModel *submenu = NULL; + + while (!action && g_menu_link_iter_get_next (iter, NULL, &submenu)) { + if (submenu) + action = shell_view_get_new_menu_first_action (submenu, manager); + + g_clear_object (&submenu); + } + + g_clear_object (&iter); + } + } + } + + return action; +} + +static void +shell_view_update_toolbar_new_menu_fallback_action_cb (GMenuModel *new_menu, + gint position, + gint removed, + gint added, + gpointer user_data) +{ + EMenuToolButton *tool_button = user_data; + EUIManager *ui_manager = NULL; + EUIAction *action; + + g_object_get (tool_button, "ui-manager", &ui_manager, NULL); + + if (!ui_manager) + return; + + action = shell_view_get_new_menu_first_action (new_menu, ui_manager); + e_menu_tool_button_set_fallback_action (tool_button, action); + + g_clear_object (&ui_manager); +} + +static void +shell_view_update_headerbar_new_menu_action_cb (GMenuModel *new_menu, + gint position, + gint removed, + gint added, + gpointer user_data) +{ + EHeaderBarButton *header_bar_button = user_data; + EUIManager *ui_manager = NULL; + EUIAction *action; + + g_object_get (header_bar_button, "ui-manager", &ui_manager, NULL); + + if (!ui_manager) + return; + + action = shell_view_get_new_menu_first_action (new_menu, ui_manager); + g_object_set (header_bar_button, "action", action, NULL); + + g_clear_object (&ui_manager); +} + static gboolean shell_view_ui_manager_create_item_cb (EUIManager *manager, EUIElement *elem, @@ -1405,11 +1504,15 @@ if (is_action ("EShellView::new-menu")) { EShellBackend *shell_backend; + EUIAction *fallback_action; GtkToolItem *tool_item; GtkWidget *menu; + fallback_action = shell_view_get_new_menu_first_action (G_MENU_MODEL (self->priv->new_menu), manager); + menu = gtk_menu_new_from_model (G_MENU_MODEL (self->priv->new_menu)); tool_item = e_menu_tool_button_new (C_("toolbar-button", "New"), manager); + e_menu_tool_button_set_fallback_action (E_MENU_TOOL_BUTTON (tool_item), fallback_action); gtk_tool_item_set_is_important (tool_item, TRUE); gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (tool_item), menu); gtk_widget_set_visible (GTK_WIDGET (tool_item), TRUE); @@ -1420,6 +1523,9 @@ tool_item, "prefer-item", G_BINDING_SYNC_CREATE); + g_signal_connect_object (self->priv->new_menu, "items-changed", + G_CALLBACK (shell_view_update_toolbar_new_menu_fallback_action_cb), tool_item, 0); + *out_item = G_OBJECT (tool_item); } else { g_warning ("%s: Unhandled toolbar action '%s'", G_STRFUNC, name); @@ -1442,9 +1548,12 @@ GtkWidget *button; GtkWidget *menu; EShellBackend *shell_backend; + EUIAction *fallback_action; + + fallback_action = shell_view_get_new_menu_first_action (G_MENU_MODEL (self->priv->new_menu), manager); menu = gtk_menu_new_from_model (G_MENU_MODEL (self->priv->new_menu)); - button = e_header_bar_button_new (C_("toolbar-button", "New"), NULL, manager); + button = e_header_bar_button_new (C_("toolbar-button", "New"), fallback_action, manager); e_header_bar_button_take_menu (E_HEADER_BAR_BUTTON (button), menu); gtk_widget_set_visible (GTK_WIDGET (button), TRUE); @@ -1454,6 +1563,9 @@ button, "prefer-item", G_BINDING_SYNC_CREATE); + g_signal_connect_object (self->priv->new_menu, "items-changed", + G_CALLBACK (shell_view_update_headerbar_new_menu_action_cb), button, 0); + *out_item = G_OBJECT (button); } else if (is_action ("EShellView::menu-button")) { *out_item = G_OBJECT (g_object_ref (self->priv->menu_button));