From 4cdb9db324a48383738dda7dd3455c702d4934e0 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 5 Dec 2019 17:17:08 -0300 Subject: [PATCH] "has-copy" is now a widget property. --- src/include/terminal.h | 1 + src/selection/selection.c | 1 + src/terminal/properties/get.c | 3 +++ src/terminal/properties/init.c | 15 +++++++++++++++ src/terminal/properties/private.h | 3 ++- 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/include/terminal.h b/src/include/terminal.h index e8072ea..363f2b7 100644 --- a/src/include/terminal.h +++ b/src/include/terminal.h @@ -77,6 +77,7 @@ G_BEGIN_DECLS GParamSpec * selection; GParamSpec * session_name; GParamSpec * trace; + GParamSpec * has_copy; struct { diff --git a/src/selection/selection.c b/src/selection/selection.c index e785b6d..f72389e 100644 --- a/src/selection/selection.c +++ b/src/selection/selection.c @@ -70,6 +70,7 @@ gboolean v3270_has_copy(GtkWidget *widget) void v3270_emit_copy_state(GtkWidget *widget) { g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, GTK_V3270(widget)->selection.blocks != NULL); + g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.has_copy); lib3270_action_group_notify(GTK_V3270(widget)->host,LIB3270_ACTION_GROUP_COPY); } diff --git a/src/terminal/properties/get.c b/src/terminal/properties/get.c index 671f396..640cb79 100644 --- a/src/terminal/properties/get.c +++ b/src/terminal/properties/get.c @@ -143,6 +143,9 @@ g_value_set_uint(value,(guint) window->selection.options); break; + case V3270_PROPERTY_HAS_COPY: + g_value_set_boolean(value,window->selection.blocks != NULL); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); diff --git a/src/terminal/properties/init.c b/src/terminal/properties/init.c index 9bb3bdd..d58869c 100644 --- a/src/terminal/properties/init.c +++ b/src/terminal/properties/init.c @@ -243,6 +243,21 @@ ); + klass->properties.has_copy = + g_param_spec_boolean( + "has_copy", + "has_copy", + _( "True if the terminal has copy blocks" ), + FALSE, + G_PARAM_READABLE + ); + + g_object_class_install_property( + gobject_class, + V3270_PROPERTY_HAS_COPY, + klass->properties.has_copy + ); + // // Create dynamic properties diff --git a/src/terminal/properties/private.h b/src/terminal/properties/private.h index bd7e178..49c920e 100644 --- a/src/terminal/properties/private.h +++ b/src/terminal/properties/private.h @@ -58,8 +58,9 @@ V3270_PROPERTY_TRACE = 9, ///< @brief Is the trace widget active? V3270_PROPERTY_TERMINAL_COLORS = 10, ///< @brief Terminal colors. V3270_PROPERTY_SELECTION_OPTIONS = 11, + V3270_PROPERTY_HAS_COPY = 12, ///< @brief Terminal has copy. - V3270_PROPERTY_DYNAMIC = 12 ///< @brief Id of the first LIB3270 internal property. + V3270_PROPERTY_DYNAMIC = 13 ///< @brief Id of the first LIB3270 internal property. }; G_GNUC_INTERNAL void v3270_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -- libgit2 0.21.2