Commit 5ce28fce5ae9c99cec80461fb754e7e50d21aa1d

Authored by perry.werneck@gmail.com
1 parent 33429708
Exists in master and in 1 other branch develop

Incluindo notificação do estado do bloco selecionado

Showing 1 changed file with 23 additions and 9 deletions   Show diff stats
widget.c
... ... @@ -77,7 +77,8 @@
77 77  
78 78  
79 79 /* Widget properties */
80   - PROP_CONNECTED,
  80 + PROP_ONLINE,
  81 + PROP_SELECTION,
81 82  
82 83 /* Toggles - always the last one, the real values are PROP_TOGGLE+LIB3270_TOGGLE */
83 84 PROP_TOGGLE
... ... @@ -359,10 +360,14 @@ static void v3270_get_property(GObject *object,guint prop_id, GValue *value, GPa
359 360  
360 361 switch (prop_id)
361 362 {
362   - case PROP_CONNECTED:
  363 + case PROP_ONLINE:
363 364 g_value_set_boolean(value,lib3270_is_connected(window->host) ? TRUE : FALSE );
364 365 break;
365 366  
  367 + case PROP_SELECTION:
  368 + g_value_set_boolean(value,lib3270_has_selection(window->host) ? TRUE : FALSE );
  369 + break;
  370 +
366 371 default:
367 372 if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT))
368 373 {
... ... @@ -643,12 +648,19 @@ static void v3270_class_init(v3270Class *klass)
643 648 gobject_class->set_property = v3270_set_property;
644 649 gobject_class->get_property = v3270_get_property;
645 650  
646   - v3270_properties[PROP_CONNECTED] = g_param_spec_boolean(
647   - "connected",
648   - "connected",
649   - "Indicates the connection state",
  651 + v3270_properties[PROP_ONLINE] = g_param_spec_boolean(
  652 + "online",
  653 + "online",
  654 + "True if is online",
650 655 FALSE,G_PARAM_READABLE);
651   - g_object_class_install_property(gobject_class,PROP_CONNECTED,v3270_properties[PROP_CONNECTED]);
  656 + g_object_class_install_property(gobject_class,PROP_ONLINE,v3270_properties[PROP_ONLINE]);
  657 +
  658 + v3270_properties[PROP_SELECTION] = g_param_spec_boolean(
  659 + "selection",
  660 + "selection",
  661 + "True on selected area",
  662 + FALSE,G_PARAM_READABLE);
  663 + g_object_class_install_property(gobject_class,PROP_SELECTION,v3270_properties[PROP_SELECTION]);
652 664  
653 665 // Toggle properties
654 666 int f;
... ... @@ -844,7 +856,7 @@ static void update_connect(H3270 *session, unsigned char connected)
844 856 g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[SIGNAL_DISCONNECTED], 0);
845 857 }
846 858  
847   - g_object_notify_by_pspec(G_OBJECT(session->widget), v3270_properties[PROP_CONNECTED]);
  859 + g_object_notify_by_pspec(G_OBJECT(session->widget), v3270_properties[PROP_ONLINE]);
848 860  
849 861 gtk_widget_queue_draw(GTK_WIDGET(widget));
850 862 }
... ... @@ -922,7 +934,9 @@ static void changed(H3270 *session, int offset, int len)
922 934  
923 935 static void set_selection(H3270 *session, unsigned char status)
924 936 {
925   - GtkWidget * widget = GTK_WIDGET(session->widget);
  937 + GtkWidget * widget = GTK_WIDGET(session->widget);
  938 +
  939 + g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties[PROP_SELECTION]);
926 940 g_signal_emit(widget,v3270_widget_signal[SIGNAL_SELECTING], 0, status ? TRUE : FALSE);
927 941 }
928 942  
... ...