Commit 4cdb9db324a48383738dda7dd3455c702d4934e0

Authored by Perry Werneck
1 parent 5ac373b9
Exists in master and in 1 other branch develop

"has-copy" is now a widget property.

src/include/terminal.h
... ... @@ -77,6 +77,7 @@ G_BEGIN_DECLS
77 77 GParamSpec * selection;
78 78 GParamSpec * session_name;
79 79 GParamSpec * trace;
  80 + GParamSpec * has_copy;
80 81  
81 82 struct
82 83 {
... ...
src/selection/selection.c
... ... @@ -70,6 +70,7 @@ gboolean v3270_has_copy(GtkWidget *widget)
70 70 void v3270_emit_copy_state(GtkWidget *widget)
71 71 {
72 72 g_signal_emit(widget,v3270_widget_signal[V3270_SIGNAL_CLIPBOARD], 0, GTK_V3270(widget)->selection.blocks != NULL);
  73 + g_object_notify_by_pspec(G_OBJECT(widget), GTK_V3270_GET_CLASS(widget)->properties.has_copy);
73 74 lib3270_action_group_notify(GTK_V3270(widget)->host,LIB3270_ACTION_GROUP_COPY);
74 75 }
75 76  
... ...
src/terminal/properties/get.c
... ... @@ -143,6 +143,9 @@
143 143 g_value_set_uint(value,(guint) window->selection.options);
144 144 break;
145 145  
  146 + case V3270_PROPERTY_HAS_COPY:
  147 + g_value_set_boolean(value,window->selection.blocks != NULL);
  148 + break;
146 149 default:
147 150 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
148 151  
... ...
src/terminal/properties/init.c
... ... @@ -243,6 +243,21 @@
243 243 );
244 244  
245 245  
  246 + klass->properties.has_copy =
  247 + g_param_spec_boolean(
  248 + "has_copy",
  249 + "has_copy",
  250 + _( "True if the terminal has copy blocks" ),
  251 + FALSE,
  252 + G_PARAM_READABLE
  253 + );
  254 +
  255 + g_object_class_install_property(
  256 + gobject_class,
  257 + V3270_PROPERTY_HAS_COPY,
  258 + klass->properties.has_copy
  259 + );
  260 +
246 261  
247 262 //
248 263 // Create dynamic properties
... ...
src/terminal/properties/private.h
... ... @@ -58,8 +58,9 @@
58 58 V3270_PROPERTY_TRACE = 9, ///< @brief Is the trace widget active?
59 59 V3270_PROPERTY_TERMINAL_COLORS = 10, ///< @brief Terminal colors.
60 60 V3270_PROPERTY_SELECTION_OPTIONS = 11,
  61 + V3270_PROPERTY_HAS_COPY = 12, ///< @brief Terminal has copy.
61 62  
62   - V3270_PROPERTY_DYNAMIC = 12 ///< @brief Id of the first LIB3270 internal property.
  63 + V3270_PROPERTY_DYNAMIC = 13 ///< @brief Id of the first LIB3270 internal property.
63 64 };
64 65  
65 66 G_GNUC_INTERNAL void v3270_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
... ...