Commit 31eff1cbecf589923685baeb2e6bba3e37058964
1 parent
6f313d3f
Exists in
master
and in
1 other branch
Melhorando tratamento de erros SSL
Showing
6 changed files
with
73 additions
and
7 deletions
Show diff stats
genmarshal
iocallback.c
... | ... | @@ -251,10 +251,10 @@ struct bgParameter |
251 | 251 | |
252 | 252 | gpointer BgCall(struct bgParameter *p) |
253 | 253 | { |
254 | - trace("%s starts",__FUNCTION__); | |
254 | +// trace("%s starts",__FUNCTION__); | |
255 | 255 | p->rc = p->callback(p->session, p->parm); |
256 | 256 | p->running = FALSE; |
257 | - trace("%s ends",__FUNCTION__); | |
257 | +// trace("%s ends",__FUNCTION__); | |
258 | 258 | return 0; |
259 | 259 | } |
260 | 260 | |
... | ... | @@ -263,7 +263,7 @@ static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *ses |
263 | 263 | struct bgParameter p = { TRUE, session, -1, callback, parm }; |
264 | 264 | GThread *thread; |
265 | 265 | |
266 | - trace("Starting auxiliary thread for callback %p",callback); | |
266 | +// trace("Starting auxiliary thread for callback %p",callback); | |
267 | 267 | |
268 | 268 | p.running = TRUE; |
269 | 269 | thread = g_thread_create( (GThreadFunc) BgCall, &p, 0, NULL); | ... | ... |
... | ... | @@ -276,7 +276,7 @@ static void draw_undera(cairo_t *cr, H3270 *host, struct v3270_metrics *metrics, |
276 | 276 | void v3270_draw_connection(cairo_t *cr, H3270 *host, struct v3270_metrics *metrics, GdkColor *color, GdkRectangle *rect) |
277 | 277 | { |
278 | 278 | cairo_text_extents_t extents; |
279 | - gchar *str = "?"; | |
279 | + const gchar *str; | |
280 | 280 | |
281 | 281 | gdk_cairo_set_source_color(cr,color+V3270_COLOR_OIA_FOREGROUND); |
282 | 282 | cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height); |
... | ... | @@ -290,9 +290,11 @@ void v3270_draw_connection(cairo_t *cr, H3270 *host, struct v3270_metrics *metri |
290 | 290 | } |
291 | 291 | |
292 | 292 | if(lib3270_in_ansi(host)) |
293 | - *str = 'N'; | |
293 | + str = "N"; | |
294 | 294 | else if(lib3270_in_sscp(host)) |
295 | - *str = 'S'; | |
295 | + str = "S"; | |
296 | + else | |
297 | + str = "?"; | |
296 | 298 | |
297 | 299 | cairo_text_extents(cr,str,&extents); |
298 | 300 | cairo_move_to(cr,rect->x+((rect->width/2)-(extents.width/2)),rect->y+extents.height+( (rect->height/2) - (extents.height/2))); | ... | ... |
private.h
... | ... | @@ -53,6 +53,7 @@ G_BEGIN_DECLS |
53 | 53 | void (*toggle_changed)(v3270 *widget,LIB3270_TOGGLE toggle_id,gboolean toggle_state,const gchar *toggle_name); |
54 | 54 | void (*message_changed)(v3270 *widget, LIB3270_MESSAGE id); |
55 | 55 | void (*luname_changed)(GtkWidget *widget,const gchar *luname); |
56 | + void (*popup_message)(GtkWidget *widget, LIB3270_NOTIFY id , const gchar *title, const gchar *message, const gchar *text); | |
56 | 57 | gboolean (*keypress)(GtkWidget *widget,guint keyval,GdkModifierType state); |
57 | 58 | |
58 | 59 | }; |
... | ... | @@ -79,6 +80,7 @@ G_BEGIN_DECLS |
79 | 80 | SIGNAL_PASTENEXT, |
80 | 81 | SIGNAL_CLIPBOARD, |
81 | 82 | SIGNAL_CHANGED, |
83 | + SIGNAL_MESSAGE, | |
82 | 84 | |
83 | 85 | LAST_SIGNAL |
84 | 86 | }; | ... | ... |
v3270.h
... | ... | @@ -181,6 +181,7 @@ |
181 | 181 | // Misc |
182 | 182 | GtkIMContext * v3270_get_im_context(GtkWidget *widget); |
183 | 183 | gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); |
184 | + void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type, const gchar *title, const gchar *message, const gchar *text); | |
184 | 185 | |
185 | 186 | void v3270_set_host(GtkWidget *widget, const gchar *uri); |
186 | 187 | ... | ... |
widget.c
... | ... | @@ -215,6 +215,46 @@ static void get_preferred_width_for_height(GtkWidget *widget,gint height, gint * |
215 | 215 | |
216 | 216 | #endif // GTK(3,0,0) |
217 | 217 | |
218 | +void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type , const gchar *title, const gchar *message, const gchar *text) | |
219 | +{ | |
220 | + GtkWidget * dialog; | |
221 | + GtkWidget * toplevel = NULL; | |
222 | + GtkMessageType msgtype = GTK_MESSAGE_WARNING; | |
223 | + GtkButtonsType buttons = GTK_BUTTONS_OK; | |
224 | + | |
225 | + if(widget && GTK_IS_WIDGET(widget)) | |
226 | + toplevel = gtk_widget_get_toplevel(GTK_WIDGET(widget)); | |
227 | + | |
228 | + if(type == LIB3270_NOTIFY_CRITICAL) | |
229 | + { | |
230 | + msgtype = GTK_MESSAGE_ERROR; | |
231 | + buttons = GTK_BUTTONS_CLOSE; | |
232 | + } | |
233 | + | |
234 | + if(!title) | |
235 | + title = _( "Error" ); | |
236 | + | |
237 | + if(message) | |
238 | + { | |
239 | + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",message); | |
240 | + if(text) | |
241 | + gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",text); | |
242 | + } | |
243 | + else if(text) | |
244 | + { | |
245 | + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",text); | |
246 | + } | |
247 | + else | |
248 | + { | |
249 | + dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(toplevel),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,msgtype,buttons,"%s",title); | |
250 | + } | |
251 | + | |
252 | + gtk_window_set_title(GTK_WINDOW(dialog),title); | |
253 | + gtk_widget_show_all(dialog); | |
254 | + gtk_dialog_run(GTK_DIALOG (dialog)); | |
255 | + gtk_widget_destroy(dialog); | |
256 | +} | |
257 | + | |
218 | 258 | static void v3270_class_init(v3270Class *klass) |
219 | 259 | { |
220 | 260 | GObjectClass * gobject_class = G_OBJECT_CLASS(klass); |
... | ... | @@ -240,6 +280,7 @@ static void v3270_class_init(v3270Class *klass) |
240 | 280 | klass->toggle_changed = v3270_toggle_changed; |
241 | 281 | klass->message_changed = v3270_update_message; |
242 | 282 | klass->luname_changed = v3270_update_luname; |
283 | + klass->popup_message = v3270_popup_message; | |
243 | 284 | |
244 | 285 | #if GTK_CHECK_VERSION(3,0,0) |
245 | 286 | |
... | ... | @@ -443,6 +484,15 @@ static void v3270_class_init(v3270Class *klass) |
443 | 484 | pw3270_VOID__VOID_UINT_UINT, |
444 | 485 | G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); |
445 | 486 | |
487 | + v3270_widget_signal[SIGNAL_MESSAGE] = | |
488 | + g_signal_new( "popup_message", | |
489 | + G_OBJECT_CLASS_TYPE (gobject_class), | |
490 | + G_SIGNAL_RUN_FIRST, | |
491 | + G_STRUCT_OFFSET (v3270Class, popup_message), | |
492 | + NULL, NULL, | |
493 | + pw3270_VOID__VOID_UINT_POINTER_POINTER_POINTER, | |
494 | + G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); | |
495 | + | |
446 | 496 | } |
447 | 497 | |
448 | 498 | void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height) |
... | ... | @@ -677,6 +727,16 @@ static void update_selection(H3270 *session, int start, int end) |
677 | 727 | |
678 | 728 | } |
679 | 729 | |
730 | +static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text) | |
731 | +{ | |
732 | + g_signal_emit( GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_MESSAGE], 0, | |
733 | + (int) id, | |
734 | + (gchar *) title, | |
735 | + (gchar *) message, | |
736 | + (gchar *) text ); | |
737 | + | |
738 | +} | |
739 | + | |
680 | 740 | static void v3270_init(v3270 *widget) |
681 | 741 | { |
682 | 742 | trace("%s",__FUNCTION__); |
... | ... | @@ -708,7 +768,7 @@ static void v3270_init(v3270 *widget) |
708 | 768 | widget->host->update_model = update_model; |
709 | 769 | widget->host->changed = changed; |
710 | 770 | widget->host->ctlr_done = ctlr_done; |
711 | - | |
771 | + widget->host->message = message; | |
712 | 772 | |
713 | 773 | // Setup input method |
714 | 774 | widget->input_method = gtk_im_multicontext_new(); | ... | ... |