From 2bc1baf7c48492683c458847d2b450c357da5c14 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Thu, 3 Jan 2013 18:04:13 +0000 Subject: [PATCH] Melhorando indicação de status da conexão SSL --- negotiated.xbm | 14 ++++++++++++++ oia.c | 19 ++++++++++++++----- unlocked.xbm | 28 ++++++++++++++-------------- widget.c | 8 ++++++++ 4 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 negotiated.xbm diff --git a/negotiated.xbm b/negotiated.xbm new file mode 100644 index 0000000..263ac23 --- /dev/null +++ b/negotiated.xbm @@ -0,0 +1,14 @@ +#define negotiated_width 32 +#define negotiated_height 32 +static unsigned char negotiated_bits[] = { + 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0x07, 0xe0, 0x00, + 0x80, 0x03, 0xc0, 0x01, 0xc0, 0xf1, 0x8f, 0x03, 0xc0, 0xf8, 0x1f, 0x03, + 0xc0, 0x1c, 0x38, 0x03, 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, + 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, + 0xc0, 0x0c, 0x30, 0x03, 0xc0, 0x0c, 0x30, 0x03, 0xf0, 0xff, 0xff, 0x0f, + 0xf0, 0xff, 0xff, 0x0f, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, + 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, + 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f }; diff --git a/oia.c b/oia.c index 17b74fb..23e3cf3 100644 --- a/oia.c +++ b/oia.c @@ -52,6 +52,7 @@ static void draw_cursor_position(cairo_t *cr, GdkRectangle *rect, struct v3270_m #include "locked.xbm" #include "unlocked.xbm" + #include "negotiated.xbm" /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -334,8 +335,16 @@ void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, struct v3270_metrics *metri bits = (unsigned char *) unlocked_bits; break; - case LIB3270_SSL_SECURE: /**< Connection secure */ - gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_FOREGROUND); + case LIB3270_SSL_NEGOTIATED: /**< Connection secure, no CA or self-signed */ + gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_STATUS_WARNING); + width = negotiated_width; + height = negotiated_height; + bits = (unsigned char *) negotiated_bits; + break; + + + case LIB3270_SSL_SECURE: /**< Connection secure with CA check */ + gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_STATUS_OK); width = locked_width; height = locked_height; bits = (unsigned char *) locked_bits; @@ -343,9 +352,9 @@ void v3270_draw_ssl_status(cairo_t *cr, H3270 *host, struct v3270_metrics *metri case LIB3270_SSL_NEGOTIATING: /**< Negotiating SSL */ gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_STATUS_WARNING); - width = locked_width; - height = locked_height; - bits = (unsigned char *) locked_bits; + width = unlocked_width; + height = unlocked_height; + bits = (unsigned char *) unlocked_bits; break; default: diff --git a/unlocked.xbm b/unlocked.xbm index 6dcf3ee..5d7ab13 100644 --- a/unlocked.xbm +++ b/unlocked.xbm @@ -1,14 +1,14 @@ -#define unlocked_width 32 -#define unlocked_height 32 -static unsigned char unlocked_bits[] = { - 0x00, 0x00, 0xff, 0x0f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0xc0, 0x01, 0x38, - 0x00, 0xe0, 0x00, 0x70, 0x00, 0x70, 0xfc, 0xe3, 0x00, 0x30, 0xfe, 0xc7, - 0x00, 0x30, 0x07, 0xce, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, - 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, - 0x00, 0x30, 0x03, 0xfc, 0x00, 0x30, 0x03, 0xfc, 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3f, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, - 0xcf, 0xcc, 0x3c, 0x00, 0xcf, 0xcc, 0x3c, 0x00, 0x33, 0x33, 0x33, 0x00, - 0x33, 0x33, 0x33, 0x00, 0xcf, 0xcc, 0x3c, 0x00, 0xcf, 0xcc, 0x3c, 0x00, - 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, 0xcf, 0xcc, 0x3c, 0x00, - 0xcf, 0xcc, 0x3c, 0x00, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x33, 0x00, - 0xff, 0xff, 0x3f, 0x00, 0xff, 0xff, 0x3f, 0x00 }; +#define unlocked_width 32 +#define unlocked_height 32 +static unsigned char unlocked_bits[] = { + 0x00, 0x00, 0xff, 0x0f, 0x00, 0x80, 0xff, 0x1f, 0x00, 0xc0, 0x01, 0x38, + 0x00, 0xe0, 0x00, 0x70, 0x00, 0x70, 0xfc, 0xe3, 0x00, 0x30, 0xfe, 0xc7, + 0x00, 0x30, 0x07, 0xce, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, + 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, 0x00, 0x30, 0x03, 0xcc, + 0x00, 0x30, 0x03, 0xfc, 0x00, 0x30, 0x03, 0xfc, 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3f, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, + 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, 0x03, 0x00, 0x30, 0x00, + 0xff, 0xff, 0x3f, 0x00, 0xff, 0xff, 0x3f, 0x00 }; diff --git a/widget.c b/widget.c index b0e7961..41f81f8 100644 --- a/widget.c +++ b/widget.c @@ -1167,6 +1167,7 @@ void v3270_set_colors(GtkWidget *widget, const gchar *colors) "#00FF00," // V3270_COLOR_OIA "#7890F0," // V3270_COLOR_OIA_SEPARATOR "#FFFFFF," // V3270_COLOR_OIA_STATUS_OK + "#FFFF00," // V3270_COLOR_OIA_STATUS_WARNING "#FF0000"; // V3270_COLOR_OIA_STATUS_INVALID } @@ -1228,8 +1229,15 @@ void v3270_set_color_table(GdkColor *table, const gchar *colors) clr = g_strsplit(colors,",",V3270_COLOR_COUNT+1); cnt = g_strv_length(clr); + switch(cnt) { + case 28: // Version 4 string + for(f=0;f < 28;f++) + gdk_color_parse(clr[f],table+f); + table[V3270_COLOR_OIA_STATUS_INVALID] = table[V3270_COLOR_OIA_STATUS_WARNING]; + break; + case V3270_COLOR_COUNT: // Complete string for(f=0;f < V3270_COLOR_COUNT;f++) gdk_color_parse(clr[f],table+f); -- libgit2 0.21.2