[evolution/gnome-3-22] Bug 777071 - Hide Memos Start date in editor when not supported



commit 40a387cca8ab75dbe6d84ea1bfa4d51116c04ef2
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 10 12:32:31 2017 +0100

    Bug 777071 - Hide Memos Start date in editor when not supported

 calendar/gui/e-comp-editor-memo.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/calendar/gui/e-comp-editor-memo.c b/calendar/gui/e-comp-editor-memo.c
index 2114c0d..6e67909 100644
--- a/calendar/gui/e-comp-editor-memo.c
+++ b/calendar/gui/e-comp-editor-memo.c
@@ -33,6 +33,7 @@
 #include "e-comp-editor-memo.h"
 
 struct _ECompEditorMemoPrivate {
+       ECompEditorPropertyPart *dtstart;
        ECompEditorPropertyPart *categories;
 
        gpointer insensitive_info_alert;
@@ -41,6 +42,27 @@ struct _ECompEditorMemoPrivate {
 G_DEFINE_TYPE (ECompEditorMemo, e_comp_editor_memo, E_TYPE_COMP_EDITOR)
 
 static void
+ece_memo_notify_target_client_cb (GObject *object,
+                                 GParamSpec *param,
+                                 gpointer user_data)
+{
+       ECompEditorMemo *memo_editor;
+       ECompEditor *comp_editor;
+       ECalClient *cal_client;
+       gboolean supports_date;
+
+       g_return_if_fail (E_IS_COMP_EDITOR_MEMO (object));
+
+       memo_editor = E_COMP_EDITOR_MEMO (object);
+       comp_editor = E_COMP_EDITOR (memo_editor);
+       cal_client = e_comp_editor_get_target_client (comp_editor);
+
+       supports_date = !cal_client || !e_client_check_capability (E_CLIENT (cal_client), 
CAL_STATIC_CAPABILITY_NO_MEMO_START_DATE);
+
+       e_comp_editor_property_part_set_visible (memo_editor->priv->dtstart, supports_date);
+}
+
+static void
 ece_memo_sensitize_widgets (ECompEditor *comp_editor,
                            gboolean force_insensitive)
 {
@@ -174,6 +196,7 @@ e_comp_editor_memo_constructed (GObject *object)
 
        part = e_comp_editor_property_part_dtstart_new (C_("ECompEditor", "Sta_rt date:"), TRUE, TRUE);
        e_comp_editor_page_add_property_part (page, part, 0, 3, 2, 1);
+       memo_editor->priv->dtstart = part;
 
        part = e_comp_editor_property_part_classification_new ();
        e_comp_editor_page_add_property_part (page, part, 0, 4, 2, 1);
@@ -199,6 +222,9 @@ e_comp_editor_memo_constructed (GObject *object)
        edit_widget = e_comp_editor_property_part_get_edit_widget (summary);
        e_binding_bind_property (edit_widget, "text", comp_editor, "title-suffix", 0);
        gtk_widget_grab_focus (edit_widget);
+
+       g_signal_connect (comp_editor, "notify::target-client",
+               G_CALLBACK (ece_memo_notify_target_client_cb), NULL);
 }
 
 static void


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