[evolution] I#1171 - Cannot copy text/click links in read-only events
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1171 - Cannot copy text/click links in read-only events
- Date: Tue, 20 Oct 2020 19:48:59 +0000 (UTC)
commit 21f573acf11fa60a33bec4ba8ed62f0478a40f9c
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 20 21:47:02 2020 +0200
I#1171 - Cannot copy text/click links in read-only events
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1171
src/calendar/gui/e-comp-editor-event.c | 6 ---
src/calendar/gui/e-comp-editor-memo.c | 7 ---
src/calendar/gui/e-comp-editor-page-general.c | 10 +----
src/calendar/gui/e-comp-editor-page.c | 16 +------
src/calendar/gui/e-comp-editor-property-part.c | 60 +++++++++++++++++++++++++
src/calendar/gui/e-comp-editor-property-part.h | 4 ++
src/calendar/gui/e-comp-editor-property-parts.c | 29 +++++++++++-
src/calendar/gui/e-comp-editor-task.c | 7 ---
8 files changed, 95 insertions(+), 44 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-event.c b/src/calendar/gui/e-comp-editor-event.c
index 1213b44189..a3e0b6f371 100644
--- a/src/calendar/gui/e-comp-editor-event.c
+++ b/src/calendar/gui/e-comp-editor-event.c
@@ -186,12 +186,6 @@ ece_event_sensitize_widgets (ECompEditor *comp_editor,
#undef sensitize_part
- /* Make the Description read-only, not completely insensitive,
- thus it can be read and scrolled through and so on */
- widget = e_comp_editor_property_part_string_get_real_edit_widget (E_COMP_EDITOR_PROPERTY_PART_STRING
(event_editor->priv->description));
- gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), gtk_widget_get_sensitive (widget));
- gtk_widget_set_sensitive (widget, TRUE);
-
action = e_comp_editor_get_action (comp_editor, "all-day-event");
gtk_action_set_sensitive (action, !force_insensitive && is_organizer);
diff --git a/src/calendar/gui/e-comp-editor-memo.c b/src/calendar/gui/e-comp-editor-memo.c
index 40d6cf47c5..c720cf48e3 100644
--- a/src/calendar/gui/e-comp-editor-memo.c
+++ b/src/calendar/gui/e-comp-editor-memo.c
@@ -188,7 +188,6 @@ ece_memo_sensitize_widgets (ECompEditor *comp_editor,
gboolean force_insensitive)
{
ECompEditorMemo *memo_editor;
- GtkWidget *widget;
gboolean is_organizer;
guint32 flags;
@@ -200,12 +199,6 @@ ece_memo_sensitize_widgets (ECompEditor *comp_editor,
is_organizer = (flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0;
memo_editor = E_COMP_EDITOR_MEMO (comp_editor);
- /* Make the Description read-only, not completely insensitive,
- thus it can be read and scrolled through and so on */
- widget = e_comp_editor_property_part_string_get_real_edit_widget (E_COMP_EDITOR_PROPERTY_PART_STRING
(memo_editor->priv->description));
- gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), gtk_widget_get_sensitive (widget));
- gtk_widget_set_sensitive (widget, TRUE);
-
if (memo_editor->priv->insensitive_info_alert)
e_alert_response (memo_editor->priv->insensitive_info_alert, GTK_RESPONSE_OK);
diff --git a/src/calendar/gui/e-comp-editor-page-general.c b/src/calendar/gui/e-comp-editor-page-general.c
index d8eecc0554..edc56196b4 100644
--- a/src/calendar/gui/e-comp-editor-page-general.c
+++ b/src/calendar/gui/e-comp-editor-page-general.c
@@ -879,15 +879,7 @@ ecep_general_sensitize_widgets (ECompEditorPage *page,
if (page_general->priv->comp_color &&
!e_comp_editor_property_part_get_sensitize_handled (page_general->priv->comp_color)) {
- GtkWidget *widget;
-
- widget = e_comp_editor_property_part_get_label_widget (page_general->priv->comp_color);
- if (widget)
- gtk_widget_set_sensitive (widget, !force_insensitive && !read_only);
-
- widget = e_comp_editor_property_part_get_edit_widget (page_general->priv->comp_color);
- if (widget)
- gtk_widget_set_sensitive (widget, !force_insensitive && !read_only);
+ e_comp_editor_property_part_sensitize_widgets (page_general->priv->comp_color,
force_insensitive || read_only);
}
g_clear_object (&comp_editor);
diff --git a/src/calendar/gui/e-comp-editor-page.c b/src/calendar/gui/e-comp-editor-page.c
index d41de8c458..ccfa085e8d 100644
--- a/src/calendar/gui/e-comp-editor-page.c
+++ b/src/calendar/gui/e-comp-editor-page.c
@@ -71,23 +71,11 @@ ecep_sensitize_widgets (ECompEditorPage *page,
for (link = page->priv->parts; link; link = g_slist_next (link)) {
PropertyPartData *ppd = link->data;
- GtkWidget *widget;
g_warn_if_fail (ppd != NULL);
- if (!ppd || e_comp_editor_property_part_get_sensitize_handled (ppd->part))
- continue;
- widget = e_comp_editor_property_part_get_label_widget (ppd->part);
- if (widget)
- gtk_widget_set_sensitive (widget, !force_insensitive);
-
- widget = e_comp_editor_property_part_get_edit_widget (ppd->part);
- if (widget) {
- if (GTK_IS_ENTRY (widget))
- g_object_set (G_OBJECT (widget), "editable", !force_insensitive, NULL);
- else
- gtk_widget_set_sensitive (widget, !force_insensitive);
- }
+ if (ppd)
+ e_comp_editor_property_part_sensitize_widgets (ppd->part, force_insensitive);
}
}
diff --git a/src/calendar/gui/e-comp-editor-property-part.c b/src/calendar/gui/e-comp-editor-property-part.c
index 7066806322..f1227552db 100644
--- a/src/calendar/gui/e-comp-editor-property-part.c
+++ b/src/calendar/gui/e-comp-editor-property-part.c
@@ -144,6 +144,27 @@ e_comp_editor_property_part_dispose (GObject *object)
G_OBJECT_CLASS (e_comp_editor_property_part_parent_class)->dispose (object);
}
+static void
+e_comp_editor_property_part_impl_sensitize_widgets (ECompEditorPropertyPart *property_part,
+ gboolean force_insensitive)
+{
+ GtkWidget *widget;
+
+ g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART (property_part));
+
+ widget = e_comp_editor_property_part_get_label_widget (property_part);
+ if (widget)
+ gtk_widget_set_sensitive (widget, !force_insensitive);
+
+ widget = e_comp_editor_property_part_get_edit_widget (property_part);
+ if (widget) {
+ if (GTK_IS_ENTRY (widget))
+ g_object_set (G_OBJECT (widget), "editable", !force_insensitive, NULL);
+ else
+ gtk_widget_set_sensitive (widget, !force_insensitive);
+ }
+}
+
static void
e_comp_editor_property_part_init (ECompEditorPropertyPart *property_part)
{
@@ -161,6 +182,8 @@ e_comp_editor_property_part_class_init (ECompEditorPropertyPartClass *klass)
g_type_class_add_private (klass, sizeof (ECompEditorPropertyPartPrivate));
+ klass->sensitize_widgets = e_comp_editor_property_part_impl_sensitize_widgets;
+
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = e_comp_editor_property_part_set_property;
object_class->get_property = e_comp_editor_property_part_get_property;
@@ -308,6 +331,24 @@ e_comp_editor_property_part_fill_component (ECompEditorPropertyPart *property_pa
klass->fill_component (property_part, component);
}
+void
+e_comp_editor_property_part_sensitize_widgets (ECompEditorPropertyPart *property_part,
+ gboolean force_insensitive)
+{
+ ECompEditorPropertyPartClass *klass;
+
+ g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART (property_part));
+
+ if (e_comp_editor_property_part_get_sensitize_handled (property_part))
+ return;
+
+ klass = E_COMP_EDITOR_PROPERTY_PART_GET_CLASS (property_part);
+ g_return_if_fail (klass != NULL);
+
+ if (klass->sensitize_widgets)
+ klass->sensitize_widgets (property_part, force_insensitive);
+}
+
void
e_comp_editor_property_part_emit_changed (ECompEditorPropertyPart *property_part)
{
@@ -533,6 +574,24 @@ ecepp_string_fill_component (ECompEditorPropertyPart *property_part,
g_free (value);
}
+static void
+ecepp_string_sensitize_widgets (ECompEditorPropertyPart *property_part,
+ gboolean force_insensitive)
+{
+ GtkWidget *widget;
+
+ g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_STRING (property_part));
+
+ widget = e_comp_editor_property_part_get_label_widget (property_part);
+ if (widget)
+ gtk_widget_set_sensitive (widget, !force_insensitive);
+
+ widget = e_comp_editor_property_part_string_get_real_edit_widget (E_COMP_EDITOR_PROPERTY_PART_STRING
(property_part));
+ g_return_if_fail (GTK_IS_ENTRY (widget) || GTK_IS_TEXT_VIEW (widget));
+
+ g_object_set (G_OBJECT (widget), "editable", !force_insensitive, NULL);
+}
+
static GtkWidget *
ecepp_string_get_real_edit_widget (ECompEditorPropertyPartString *part_string)
{
@@ -569,6 +628,7 @@ e_comp_editor_property_part_string_class_init (ECompEditorPropertyPartStringClas
part_class->create_widgets = ecepp_string_create_widgets;
part_class->fill_widget = ecepp_string_fill_widget;
part_class->fill_component = ecepp_string_fill_component;
+ part_class->sensitize_widgets = ecepp_string_sensitize_widgets;
}
void
diff --git a/src/calendar/gui/e-comp-editor-property-part.h b/src/calendar/gui/e-comp-editor-property-part.h
index 96f0062f3e..231e201bfa 100644
--- a/src/calendar/gui/e-comp-editor-property-part.h
+++ b/src/calendar/gui/e-comp-editor-property-part.h
@@ -168,6 +168,8 @@ struct _ECompEditorPropertyPartClass {
ICalComponent *component);
void (* fill_component) (ECompEditorPropertyPart *property_part,
ICalComponent *component);
+ void (* sensitize_widgets) (ECompEditorPropertyPart *property_part,
+ gboolean force_insensitive);
/* Signals */
void (* changed) (ECompEditorPropertyPart *property_part);
@@ -191,6 +193,8 @@ void e_comp_editor_property_part_fill_widget
(ECompEditorPropertyPart *propert
ICalComponent *component);
void e_comp_editor_property_part_fill_component (ECompEditorPropertyPart *property_part,
ICalComponent *component);
+void e_comp_editor_property_part_sensitize_widgets (ECompEditorPropertyPart *property_part,
+ gboolean force_insensitive);
void e_comp_editor_property_part_emit_changed (ECompEditorPropertyPart *property_part);
/* ************************************************************************* */
diff --git a/src/calendar/gui/e-comp-editor-property-parts.c b/src/calendar/gui/e-comp-editor-property-parts.c
index bafb011d4d..23569a690b 100644
--- a/src/calendar/gui/e-comp-editor-property-parts.c
+++ b/src/calendar/gui/e-comp-editor-property-parts.c
@@ -543,6 +543,7 @@ struct _ECompEditorPropertyPartDescription {
gboolean mode_html;
gchar *alt_desc; /* X-ALT-DESC with text/html format */
GtkWidget *real_edit_widget;
+ GtkWidget *description_label;
GtkWidget *view_as_label;
GtkWidget *web_view_scrolled_window;
GtkWidget *web_view;
@@ -571,7 +572,9 @@ ecepp_description_update_view_mode (ECompEditorPropertyPartDescription *descript
gchar *markup;
markup = g_markup_printf_escaped ("<a href=\"evo-switch-view-mode\">%s</a>",
- description_part->mode_html ? _("Edit as text") : _("View as HTML"));
+ description_part->mode_html ?
+ ((description_part->description_label && gtk_widget_get_sensitive
(description_part->description_label)) ?
+ _("Edit as text") : _("View as text")) : _("View as HTML"));
gtk_label_set_markup (GTK_LABEL (description_part->view_as_label), markup);
@@ -661,6 +664,8 @@ ecepp_description_create_widgets (ECompEditorPropertyPart *property_part,
label = gtk_label_new_with_mnemonic (C_("ECompEditor", "_Description:"));
gtk_label_set_mnemonic_widget (GTK_LABEL (label), *out_edit_widget);
+ description_part->description_label = label;
+
text_view = GTK_TEXT_VIEW (gtk_bin_get_child (GTK_BIN (*out_edit_widget)));
gtk_text_view_set_wrap_mode (text_view, GTK_WRAP_WORD);
gtk_text_view_set_monospace (text_view, TRUE);
@@ -869,6 +874,27 @@ ecepp_description_fill_component (ECompEditorPropertyPart *property_part,
}
}
+static void
+ecepp_description_sensitize_widgets (ECompEditorPropertyPart *property_part,
+ gboolean force_insensitive)
+{
+ ECompEditorPropertyPartDescription *description_part;
+ GtkWidget *widget;
+
+ g_return_if_fail (E_IS_COMP_EDITOR_PROPERTY_PART_DESCRIPTION (property_part));
+
+ description_part = E_COMP_EDITOR_PROPERTY_PART_DESCRIPTION (property_part);
+
+ if (description_part->description_label)
+ gtk_widget_set_sensitive (description_part->description_label, !force_insensitive);
+
+ widget = e_comp_editor_property_part_string_get_real_edit_widget (E_COMP_EDITOR_PROPERTY_PART_STRING
(description_part));
+ if (widget)
+ g_object_set (G_OBJECT (widget), "editable", !force_insensitive, NULL);
+
+ ecepp_description_update_view_mode (description_part);
+}
+
static void
ecepp_description_dispose (GObject *object)
{
@@ -904,6 +930,7 @@ e_comp_editor_property_part_description_class_init (ECompEditorPropertyPartDescr
part_class->create_widgets = ecepp_description_create_widgets;
part_class->fill_widget = ecepp_description_fill_widget;
part_class->fill_component = ecepp_description_fill_component;
+ part_class->sensitize_widgets = ecepp_description_sensitize_widgets;
object_class = G_OBJECT_CLASS (klass);
object_class->dispose = ecepp_description_dispose;
diff --git a/src/calendar/gui/e-comp-editor-task.c b/src/calendar/gui/e-comp-editor-task.c
index 6c94f79b12..7274e774d7 100644
--- a/src/calendar/gui/e-comp-editor-task.c
+++ b/src/calendar/gui/e-comp-editor-task.c
@@ -497,7 +497,6 @@ ece_task_sensitize_widgets (ECompEditor *comp_editor,
{
ECompEditorTask *task_editor;
GtkAction *action;
- GtkWidget *widget;
gboolean is_organizer;
guint32 flags;
@@ -509,12 +508,6 @@ ece_task_sensitize_widgets (ECompEditor *comp_editor,
is_organizer = (flags & (E_COMP_EDITOR_FLAG_IS_NEW | E_COMP_EDITOR_FLAG_ORGANIZER_IS_USER)) != 0;
task_editor = E_COMP_EDITOR_TASK (comp_editor);
- /* Make the Description read-only, not completely insensitive,
- thus it can be read and scrolled through and so on */
- widget = e_comp_editor_property_part_string_get_real_edit_widget (E_COMP_EDITOR_PROPERTY_PART_STRING
(task_editor->priv->description));
- gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), gtk_widget_get_sensitive (widget));
- gtk_widget_set_sensitive (widget, TRUE);
-
action = e_comp_editor_get_action (comp_editor, "all-day-task");
gtk_action_set_sensitive (action, !force_insensitive && is_organizer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]