Commit 985b0a60776ca99163db12afdc8fe4a232c9b638
1 parent
3ceeedba
Exists in
master
and in
5 other branches
Removendo mais funções "deprecated"
Showing
1 changed file
with
37 additions
and
1 deletions
Show diff stats
src/pw3270/v3270/widget.c
| ... | ... | @@ -75,7 +75,11 @@ |
| 75 | 75 | /* Construct */ |
| 76 | 76 | PROP_TYPE, |
| 77 | 77 | |
| 78 | - /* Toggle - always the last one, the real values are PROP_TOGGLE+LIB3270_TOGGLE */ | |
| 78 | + | |
| 79 | + /* Widget properties */ | |
| 80 | + PROP_CONNECTED, | |
| 81 | + | |
| 82 | + /* Toggles - always the last one, the real values are PROP_TOGGLE+LIB3270_TOGGLE */ | |
| 79 | 83 | PROP_TOGGLE |
| 80 | 84 | }; |
| 81 | 85 | |
| ... | ... | @@ -271,17 +275,29 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa |
| 271 | 275 | { |
| 272 | 276 | if(!lib3270_connected(GTK_V3270(widget)->host)) |
| 273 | 277 | { |
| 278 | +#if GTK_CHECK_VERSION(2,14,0) | |
| 279 | + gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-disconnect",GTK_ICON_SIZE_MENU); | |
| 280 | +#else | |
| 274 | 281 | gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_DISCONNECT,GTK_ICON_SIZE_MENU); |
| 282 | +#endif // GTK_CHECK_VERSION | |
| 275 | 283 | gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nDisconnected from host" ) ); |
| 276 | 284 | } |
| 277 | 285 | else if(lib3270_get_secure(GTK_V3270(widget)->host) == LIB3270_SSL_UNSECURE) |
| 278 | 286 | { |
| 287 | +#if GTK_CHECK_VERSION(2,14,0) | |
| 288 | + gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-information",GTK_ICON_SIZE_MENU); | |
| 289 | +#else | |
| 279 | 290 | gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_INFO,GTK_ICON_SIZE_MENU); |
| 291 | +#endif | |
| 280 | 292 | gtk_tooltip_set_markup(tooltip,_( "<b>Identity not verified</b>\nThe connection is insecure" ) ); |
| 281 | 293 | } |
| 282 | 294 | else if(!lib3270_get_SSL_verify_result(GTK_V3270(widget)->host)) |
| 283 | 295 | { |
| 296 | +#if GTK_CHECK_VERSION(2,14,0) | |
| 297 | + gtk_tooltip_set_icon_from_icon_name(tooltip,"gtk-dialog-authentication",GTK_ICON_SIZE_MENU); | |
| 298 | +#else | |
| 284 | 299 | gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_DIALOG_AUTHENTICATION,GTK_ICON_SIZE_MENU); |
| 300 | +#endif | |
| 285 | 301 | gtk_tooltip_set_markup(tooltip,_( "<b>Identity verified</b>\nThe connection is secure" ) ); |
| 286 | 302 | } |
| 287 | 303 | else |
| ... | ... | @@ -291,14 +307,22 @@ gboolean v3270_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboa |
| 291 | 307 | if(msg) |
| 292 | 308 | { |
| 293 | 309 | gchar *text = g_strdup_printf("<b>%s</b>\n%s",_("Identity not verified"),gettext(msg->text)); |
| 310 | +#if GTK_CHECK_VERSION(2,14,0) | |
| 311 | + gtk_tooltip_set_icon_from_icon_name(tooltip,msg->icon,GTK_ICON_SIZE_MENU); | |
| 312 | +#else | |
| 294 | 313 | gtk_tooltip_set_icon_from_stock(tooltip,msg->icon,GTK_ICON_SIZE_MENU); |
| 314 | +#endif | |
| 295 | 315 | gtk_tooltip_set_markup(tooltip,text); |
| 296 | 316 | g_free(text); |
| 297 | 317 | } |
| 298 | 318 | else |
| 299 | 319 | { |
| 300 | 320 | gchar *text = g_strdup_printf(_("<b>SSL state is undefined</b>Unexpected SSL status %ld"),lib3270_get_SSL_verify_result(GTK_V3270(widget)->host)); |
| 321 | +#if GTK_CHECK_VERSION(2,14,0) | |
| 322 | + gtk_tooltip_set_icon_from_icon_name(tooltip,"dialog-error",GTK_ICON_SIZE_MENU); | |
| 323 | +#else | |
| 301 | 324 | gtk_tooltip_set_icon_from_stock(tooltip,GTK_STOCK_DIALOG_ERROR,GTK_ICON_SIZE_MENU); |
| 325 | +#endif // GTK_CHECK_VERSION | |
| 302 | 326 | gtk_tooltip_set_markup(tooltip,text); |
| 303 | 327 | g_free(text); |
| 304 | 328 | } |
| ... | ... | @@ -335,6 +359,9 @@ static void v3270_get_property(GObject *object,guint prop_id, GValue *value, GPa |
| 335 | 359 | |
| 336 | 360 | switch (prop_id) |
| 337 | 361 | { |
| 362 | + case PROP_CONNECTED: | |
| 363 | + g_value_set_boolean(value,lib3270_is_connected(window->host) ? TRUE : FALSE ); | |
| 364 | + break; | |
| 338 | 365 | |
| 339 | 366 | default: |
| 340 | 367 | if(prop_id < (PROP_TOGGLE + LIB3270_TOGGLE_COUNT)) |
| ... | ... | @@ -616,6 +643,13 @@ static void v3270_class_init(v3270Class *klass) |
| 616 | 643 | gobject_class->set_property = v3270_set_property; |
| 617 | 644 | gobject_class->get_property = v3270_get_property; |
| 618 | 645 | |
| 646 | + v3270_properties[PROP_CONNECTED] = g_param_spec_boolean( | |
| 647 | + "connected", | |
| 648 | + "connected", | |
| 649 | + "Indicates the connection state", | |
| 650 | + FALSE,G_PARAM_READABLE); | |
| 651 | + g_object_class_install_property(gobject_class,PROP_CONNECTED,v3270_properties[PROP_CONNECTED]); | |
| 652 | + | |
| 619 | 653 | // Toggle properties |
| 620 | 654 | int f; |
| 621 | 655 | |
| ... | ... | @@ -810,6 +844,8 @@ static void update_connect(H3270 *session, unsigned char connected) |
| 810 | 844 | g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[SIGNAL_DISCONNECTED], 0); |
| 811 | 845 | } |
| 812 | 846 | |
| 847 | + g_object_notify_by_pspec(G_OBJECT(session->widget), v3270_properties[PROP_CONNECTED]); | |
| 848 | + | |
| 813 | 849 | gtk_widget_queue_draw(GTK_WIDGET(widget)); |
| 814 | 850 | } |
| 815 | 851 | ... | ... |