[evolution] Flatpak: Hide Save All button in attachment bar
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Flatpak: Hide Save All button in attachment bar
- Date: Wed, 21 Aug 2019 12:02:42 +0000 (UTC)
commit eee405f8841c0d58edb57663f8ed770d8ca38259
Author: Milan Crha <mcrha redhat com>
Date: Wed Aug 21 14:00:36 2019 +0200
Flatpak: Hide Save All button in attachment bar
The GtkFileChooserNativePortal does not support GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
at the moment, which 'Save All' button uses, thus hide the button when running
under Flatpak for now.
src/e-util/e-attachment-bar.c | 2 +-
src/e-util/e-attachment-view.c | 25 +++++++++++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/e-util/e-attachment-bar.c b/src/e-util/e-attachment-bar.c
index cbdd684d14..b2df0fd8c4 100644
--- a/src/e-util/e-attachment-bar.c
+++ b/src/e-util/e-attachment-bar.c
@@ -109,7 +109,7 @@ attachment_bar_update_status (EAttachmentBar *bar)
activatable = GTK_ACTIVATABLE (bar->priv->save_all_button);
action = gtk_activatable_get_related_action (activatable);
- gtk_action_set_visible (action, (num_attachments > 1));
+ gtk_action_set_visible (action, (num_attachments > 1 && !e_util_is_running_flatpak ()));
activatable = GTK_ACTIVATABLE (bar->priv->save_one_button);
action = gtk_activatable_get_related_action (activatable);
diff --git a/src/e-util/e-attachment-view.c b/src/e-util/e-attachment-view.c
index b65e99da05..e0c614f81c 100644
--- a/src/e-util/e-attachment-view.c
+++ b/src/e-util/e-attachment-view.c
@@ -735,7 +735,7 @@ attachment_view_update_actions (EAttachmentView *view)
gtk_action_set_visible (action, !busy && n_selected > 0);
action = e_attachment_view_get_action (view, "save-as");
- gtk_action_set_visible (action, !busy && n_selected > 0);
+ gtk_action_set_visible (action, !busy && (n_selected == 1 || (n_selected > 0 &&
!e_util_is_running_flatpak ())));
/* Clear out the "openwith" action group. */
gtk_ui_manager_remove_ui (priv->ui_manager, priv->merge_id);
@@ -1224,6 +1224,24 @@ e_attachment_view_remove_selected (EAttachmentView *view,
g_list_free (list);
}
+static gboolean
+attachment_view_any_popup_item_visible (GtkWidget *widget)
+{
+ GList *items, *link;
+ gboolean any_visible = FALSE;
+
+ g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
+
+ items = gtk_container_get_children (GTK_CONTAINER (widget));
+ for (link = items; link && !any_visible; link = g_list_next (link)) {
+ any_visible = gtk_widget_get_visible (link->data);
+ }
+
+ g_list_free (items);
+
+ return any_visible;
+}
+
gboolean
e_attachment_view_button_press_event (EAttachmentView *view,
GdkEventButton *event)
@@ -1300,7 +1318,10 @@ e_attachment_view_button_press_event (EAttachmentView *view,
if (path != NULL || editable) {
e_attachment_view_update_actions (view);
menu = e_attachment_view_get_popup_menu (view);
- gtk_menu_popup_at_pointer (GTK_MENU (menu), (const GdkEvent *) event);
+ if (attachment_view_any_popup_item_visible (menu))
+ gtk_menu_popup_at_pointer (GTK_MENU (menu), (const GdkEvent *) event);
+ else
+ g_signal_emit_by_name (menu, "deactivate", NULL);
handled = TRUE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]