[evolution] I#1730 - ToDo Bar: Disallow deleting read-only events and tasks



commit b2d2f3fc54557e6f6bf498103cdf78602a22e5d5
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 13 11:12:03 2021 +0100

    I#1730 - ToDo Bar: Disallow deleting read-only events and tasks
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1730

 src/calendar/gui/e-to-do-pane.c | 60 +++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 29 deletions(-)
---
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index e537aeccd6..509a7bb2bc 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -2235,41 +2235,43 @@ etdp_fill_popup_menu (EToDoPane *to_do_pane,
                gtk_widget_show (item);
                gtk_menu_shell_append (menu_shell, item);
 
-               if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT &&
-                   e_cal_component_is_instance (comp)) {
-                       item = gtk_image_menu_item_new_with_mnemonic (_("_Delete This Instance…"));
-                       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
-                               gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU));
-                       g_signal_connect (item, "activate",
-                               G_CALLBACK (etdp_delete_selected_cb), to_do_pane);
-                       gtk_widget_show (item);
-                       gtk_menu_shell_append (menu_shell, item);
-
-                       if (!e_client_check_capability (E_CLIENT (client), 
E_CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) {
-                               item = gtk_image_menu_item_new_with_mnemonic (_("Delete This and F_uture 
Occurrences…"));
+               if (!e_client_is_readonly (E_CLIENT (client))) {
+                       if (e_cal_component_get_vtype (comp) == E_CAL_COMPONENT_EVENT &&
+                           e_cal_component_is_instance (comp)) {
+                               item = gtk_image_menu_item_new_with_mnemonic (_("_Delete This Instance…"));
                                gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
                                        gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU));
                                g_signal_connect (item, "activate",
-                                       G_CALLBACK (etdp_delete_this_and_future_cb), to_do_pane);
+                                       G_CALLBACK (etdp_delete_selected_cb), to_do_pane);
                                gtk_widget_show (item);
                                gtk_menu_shell_append (menu_shell, item);
-                       }
 
-                       item = gtk_image_menu_item_new_with_mnemonic (_("D_elete All Instances…"));
-                       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
-                               gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU));
-                       g_signal_connect (item, "activate",
-                               G_CALLBACK (etdp_delete_series_cb), to_do_pane);
-                       gtk_widget_show (item);
-                       gtk_menu_shell_append (menu_shell, item);
-               } else {
-                       item = gtk_image_menu_item_new_with_mnemonic (_("_Delete…"));
-                       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
-                               gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU));
-                       g_signal_connect (item, "activate",
-                               G_CALLBACK (etdp_delete_series_cb), to_do_pane);
-                       gtk_widget_show (item);
-                       gtk_menu_shell_append (menu_shell, item);
+                               if (!e_client_check_capability (E_CLIENT (client), 
E_CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) {
+                                       item = gtk_image_menu_item_new_with_mnemonic (_("Delete This and 
F_uture Occurrences…"));
+                                       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+                                               gtk_image_new_from_icon_name ("edit-delete", 
GTK_ICON_SIZE_MENU));
+                                       g_signal_connect (item, "activate",
+                                               G_CALLBACK (etdp_delete_this_and_future_cb), to_do_pane);
+                                       gtk_widget_show (item);
+                                       gtk_menu_shell_append (menu_shell, item);
+                               }
+
+                               item = gtk_image_menu_item_new_with_mnemonic (_("D_elete All Instances…"));
+                               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+                                       gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU));
+                               g_signal_connect (item, "activate",
+                                       G_CALLBACK (etdp_delete_series_cb), to_do_pane);
+                               gtk_widget_show (item);
+                               gtk_menu_shell_append (menu_shell, item);
+                       } else {
+                               item = gtk_image_menu_item_new_with_mnemonic (_("_Delete…"));
+                               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+                                       gtk_image_new_from_icon_name ("edit-delete", GTK_ICON_SIZE_MENU));
+                               g_signal_connect (item, "activate",
+                                       G_CALLBACK (etdp_delete_series_cb), to_do_pane);
+                               gtk_widget_show (item);
+                               gtk_menu_shell_append (menu_shell, item);
+                       }
                }
        }
 


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