[evolution] I#478 - Use correct values in STATUS for respective component kinds ][



commit 1b67df8c706bc9553c000a0e407a0b380df1c5b3
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 10 10:12:46 2019 +0200

    I#478 - Use correct values in STATUS for respective component kinds ][
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/478

 src/calendar/gui/e-comp-editor-event.c          |  2 +-
 src/calendar/gui/e-comp-editor-memo.c           |  2 +-
 src/calendar/gui/e-comp-editor-property-parts.c | 46 +++++++++++++++++++++----
 src/calendar/gui/e-comp-editor-property-parts.h |  2 +-
 src/calendar/gui/e-comp-editor-task.c           |  2 +-
 5 files changed, 43 insertions(+), 11 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-event.c b/src/calendar/gui/e-comp-editor-event.c
index 7e4aabbcf7..3025791ac9 100644
--- a/src/calendar/gui/e-comp-editor-event.c
+++ b/src/calendar/gui/e-comp-editor-event.c
@@ -906,7 +906,7 @@ e_comp_editor_event_constructed (GObject *object)
        /* Transparency checkbox is not shown in the page, even it's packed there */
        gtk_widget_hide (widget);
 
-       part = e_comp_editor_property_part_status_new ();
+       part = e_comp_editor_property_part_status_new (I_CAL_VEVENT_COMPONENT);
        e_comp_editor_page_add_property_part (page, part, 0, 7, 3, 1);
 
        widget = e_comp_editor_property_part_get_edit_widget (part);
diff --git a/src/calendar/gui/e-comp-editor-memo.c b/src/calendar/gui/e-comp-editor-memo.c
index dbc840bc76..1a1bff2f74 100644
--- a/src/calendar/gui/e-comp-editor-memo.c
+++ b/src/calendar/gui/e-comp-editor-memo.c
@@ -211,7 +211,7 @@ e_comp_editor_memo_constructed (GObject *object)
        gtk_widget_set_halign (edit_widget, GTK_ALIGN_START);
        gtk_widget_set_hexpand (edit_widget, FALSE);
 
-       part = e_comp_editor_property_part_status_new ();
+       part = e_comp_editor_property_part_status_new (I_CAL_VJOURNAL_COMPONENT);
        e_comp_editor_page_add_property_part (page, part, 0, 5, 2, 1);
 
        edit_widget = e_comp_editor_property_part_get_edit_widget (part);
diff --git a/src/calendar/gui/e-comp-editor-property-parts.c b/src/calendar/gui/e-comp-editor-property-parts.c
index 58b94aa40e..296a6e7efd 100644
--- a/src/calendar/gui/e-comp-editor-property-parts.c
+++ b/src/calendar/gui/e-comp-editor-property-parts.c
@@ -1199,15 +1199,47 @@ e_comp_editor_property_part_classification_new (void)
 /* ************************************************************************* */
 
 ECompEditorPropertyPart *
-e_comp_editor_property_part_status_new (void)
+e_comp_editor_property_part_status_new (ICalComponentKind kind)
 {
-       ECompEditorPropertyPartPickerMap map[] = {
-               { I_CAL_STATUS_NONE,      NC_("ECompEditor", "Not Started"), TRUE,  NULL },
-               { I_CAL_STATUS_INPROCESS, NC_("ECompEditor", "In Progress"), FALSE, NULL },
-               { I_CAL_STATUS_COMPLETED, NC_("ECompEditor", "Completed"),   FALSE, NULL },
-               { I_CAL_STATUS_CANCELLED, NC_("ECompEditor", "Cancelled"),    FALSE, NULL }
+       ECompEditorPropertyPartPickerMap map_vevent[] = {
+               { I_CAL_STATUS_NONE,      NC_("ECompEditor", "None"),      TRUE,  NULL },
+               { I_CAL_STATUS_TENTATIVE, NC_("ECompEditor", "Tentative"), FALSE, NULL },
+               { I_CAL_STATUS_CONFIRMED, NC_("ECompEditor", "Confirmed"), FALSE, NULL },
+               { I_CAL_STATUS_CANCELLED, NC_("ECompEditor", "Cancelled"), FALSE, NULL }
        };
-       gint ii, n_elems = G_N_ELEMENTS (map);
+       ECompEditorPropertyPartPickerMap map_vjournal[] = {
+               { I_CAL_STATUS_NONE,      NC_("ECompEditor", "None"),      TRUE,  NULL },
+               { I_CAL_STATUS_DRAFT,     NC_("ECompEditor", "Draft"),     FALSE, NULL },
+               { I_CAL_STATUS_FINAL,     NC_("ECompEditor", "Final"),     FALSE, NULL },
+               { I_CAL_STATUS_CANCELLED, NC_("ECompEditor", "Cancelled"), FALSE, NULL }
+       };
+       ECompEditorPropertyPartPickerMap map_vtodo[] = {
+               { I_CAL_STATUS_NONE,        NC_("ECompEditor", "Not Started"),  TRUE,  NULL },
+               { I_CAL_STATUS_NEEDSACTION, NC_("ECompEditor", "Needs Action"), FALSE, NULL },
+               { I_CAL_STATUS_INPROCESS,   NC_("ECompEditor", "In Progress"),  FALSE, NULL },
+               { I_CAL_STATUS_COMPLETED,   NC_("ECompEditor", "Completed"),    FALSE, NULL },
+               { I_CAL_STATUS_CANCELLED,   NC_("ECompEditor", "Cancelled"),    FALSE, NULL }
+       };
+       ECompEditorPropertyPartPickerMap *map;
+       gint ii, n_elems;
+
+       switch (kind) {
+       case I_CAL_VEVENT_COMPONENT:
+               map = map_vevent;
+               n_elems = G_N_ELEMENTS (map_vevent);
+               break;
+       case I_CAL_VJOURNAL_COMPONENT:
+               map = map_vjournal;
+               n_elems = G_N_ELEMENTS (map_vjournal);
+               break;
+       default:
+               g_warn_if_reached ();
+               /* Falls through */
+       case I_CAL_VTODO_COMPONENT:
+               map = map_vtodo;
+               n_elems = G_N_ELEMENTS (map_vtodo);
+               break;
+       }
 
        for (ii = 0; ii < n_elems; ii++) {
                map[ii].description = g_dpgettext2 (GETTEXT_PACKAGE, "ECompEditor", map[ii].description);
diff --git a/src/calendar/gui/e-comp-editor-property-parts.h b/src/calendar/gui/e-comp-editor-property-parts.h
index dbc03a637e..5a3954f337 100644
--- a/src/calendar/gui/e-comp-editor-property-parts.h
+++ b/src/calendar/gui/e-comp-editor-property-parts.h
@@ -51,7 +51,7 @@ ECompEditorPropertyPart *
 ECompEditorPropertyPart *
                e_comp_editor_property_part_classification_new  (void);
 ECompEditorPropertyPart *
-               e_comp_editor_property_part_status_new          (void);
+               e_comp_editor_property_part_status_new          (ICalComponentKind kind);
 ECompEditorPropertyPart *
                e_comp_editor_property_part_priority_new        (void);
 ECompEditorPropertyPart *
diff --git a/src/calendar/gui/e-comp-editor-task.c b/src/calendar/gui/e-comp-editor-task.c
index 4869dd82a8..513b7a5ba1 100644
--- a/src/calendar/gui/e-comp-editor-task.c
+++ b/src/calendar/gui/e-comp-editor-task.c
@@ -802,7 +802,7 @@ e_comp_editor_task_constructed (GObject *object)
        edit_widget = e_comp_editor_property_part_get_edit_widget (part);
        g_signal_connect (edit_widget, "changed", G_CALLBACK (ece_task_dtstart_changed_cb), task_editor);
 
-       part = e_comp_editor_property_part_status_new ();
+       part = e_comp_editor_property_part_status_new (I_CAL_VTODO_COMPONENT);
        e_comp_editor_page_add_property_part (page, part, 2, 4, 2, 1);
        task_editor->priv->status = part;
 


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