Commit bb4e13f2eb4d91e0b6c1081a4de2f4b3d3f22014
1 parent
f3a42a70
Exists in
master
and in
5 other branches
Substituindo "widget" por "user_data" na estrutura de sessão
Showing
9 changed files
with
63 additions
and
67 deletions
Show diff stats
src/include/lib3270.h
| @@ -792,6 +792,18 @@ | @@ -792,6 +792,18 @@ | ||
| 792 | LIB3270_EXPORT void lib3270_main_iterate(H3270 *h, int wait); | 792 | LIB3270_EXPORT void lib3270_main_iterate(H3270 *h, int wait); |
| 793 | 793 | ||
| 794 | /** | 794 | /** |
| 795 | + * @brief Associate user data with 3270 session. | ||
| 796 | + * | ||
| 797 | + */ | ||
| 798 | + LIB3270_EXPORT void lib3270_set_user_data(H3270 *h, void *ptr); | ||
| 799 | + | ||
| 800 | + /** | ||
| 801 | + * @brief Get associated user data. | ||
| 802 | + * | ||
| 803 | + */ | ||
| 804 | + LIB3270_EXPORT void * lib3270_get_user_data(H3270 *h); | ||
| 805 | + | ||
| 806 | + /** | ||
| 795 | * @brief Iterate internal's lib3270 event loop. | 807 | * @brief Iterate internal's lib3270 event loop. |
| 796 | * | 808 | * |
| 797 | * Use it only if the internal I/O calls wasn't replaced. | 809 | * Use it only if the internal I/O calls wasn't replaced. |
| @@ -818,18 +830,6 @@ | @@ -818,18 +830,6 @@ | ||
| 818 | LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds); | 830 | LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds); |
| 819 | 831 | ||
| 820 | /** | 832 | /** |
| 821 | - * Get the session's widget. | ||
| 822 | - * | ||
| 823 | - * Get the handle to the GtkWidget who's handling this session. | ||
| 824 | - * | ||
| 825 | - * @param h Session handle. | ||
| 826 | - * | ||
| 827 | - * @return Associated GtkWidget (can be null) | ||
| 828 | - * | ||
| 829 | - */ | ||
| 830 | - LIB3270_EXPORT void * lib3270_get_widget(H3270 *h); | ||
| 831 | - | ||
| 832 | - /** | ||
| 833 | * "beep" to notify user. | 833 | * "beep" to notify user. |
| 834 | * | 834 | * |
| 835 | * If available play a sound signal do alert user. | 835 | * If available play a sound signal do alert user. |
src/include/lib3270/session.h
| @@ -282,8 +282,8 @@ | @@ -282,8 +282,8 @@ | ||
| 282 | char * rpq_warnbuf; | 282 | char * rpq_warnbuf; |
| 283 | int rpq_wbcnt; | 283 | int rpq_wbcnt; |
| 284 | 284 | ||
| 285 | - // Widget info | ||
| 286 | - void * widget; | 285 | + // User data (Usually points to session's widget) |
| 286 | + void * user_data; | ||
| 287 | 287 | ||
| 288 | // selection | 288 | // selection |
| 289 | char * paste_buffer; | 289 | char * paste_buffer; |
src/lib3270/iocalls.c
| @@ -51,15 +51,6 @@ static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, vo | @@ -51,15 +51,6 @@ static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, vo | ||
| 51 | static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); | 51 | static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); |
| 52 | static void internal_remove_poll(void *id); | 52 | static void internal_remove_poll(void *id); |
| 53 | 53 | ||
| 54 | - | ||
| 55 | -/* | ||
| 56 | -// fdcalls | ||
| 57 | -static void internal_remove_source(void *id); | ||
| 58 | -static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
| 59 | -static void * internal_add_output(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
| 60 | -static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
| 61 | -*/ | ||
| 62 | - | ||
| 63 | static int internal_wait(H3270 *hSession, int seconds); | 54 | static int internal_wait(H3270 *hSession, int seconds); |
| 64 | 55 | ||
| 65 | static int internal_event_dispatcher(H3270 *hSession, int block); | 56 | static int internal_event_dispatcher(H3270 *hSession, int block); |
src/lib3270/screen.c
| @@ -688,7 +688,7 @@ void Error(H3270 *session, const char *fmt, ...) | @@ -688,7 +688,7 @@ void Error(H3270 *session, const char *fmt, ...) | ||
| 688 | 688 | ||
| 689 | va_start(arg_ptr, fmt); | 689 | va_start(arg_ptr, fmt); |
| 690 | 690 | ||
| 691 | - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); | 691 | + popup_handler(session,session->user_data,LIB3270_NOTIFY_ERROR, _( "3270 Error" ),NULL,fmt,arg_ptr); |
| 692 | 692 | ||
| 693 | va_end(arg_ptr); | 693 | va_end(arg_ptr); |
| 694 | 694 | ||
| @@ -703,7 +703,7 @@ void Warning(H3270 *session, const char *fmt, ...) | @@ -703,7 +703,7 @@ void Warning(H3270 *session, const char *fmt, ...) | ||
| 703 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Warning",fmt); | 703 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Warning",fmt); |
| 704 | 704 | ||
| 705 | va_start(arg_ptr, fmt); | 705 | va_start(arg_ptr, fmt); |
| 706 | - popup_handler(session,session->widget,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr); | 706 | + popup_handler(session,session->user_data,LIB3270_NOTIFY_WARNING, _( "3270 Warning" ),NULL,fmt,arg_ptr); |
| 707 | va_end(arg_ptr); | 707 | va_end(arg_ptr); |
| 708 | 708 | ||
| 709 | } | 709 | } |
| @@ -718,7 +718,7 @@ void popup_an_error(H3270 *session, const char *fmt, ...) | @@ -718,7 +718,7 @@ void popup_an_error(H3270 *session, const char *fmt, ...) | ||
| 718 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Error",fmt); | 718 | trace("%s: title=%s fmt=%s",__FUNCTION__,"3270 Error",fmt); |
| 719 | 719 | ||
| 720 | va_start(args, fmt); | 720 | va_start(args, fmt); |
| 721 | - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args); | 721 | + popup_handler(session,session->user_data,LIB3270_NOTIFY_ERROR,_( "3270 Error" ),NULL,fmt,args); |
| 722 | va_end(args); | 722 | va_end(args); |
| 723 | 723 | ||
| 724 | } | 724 | } |
| @@ -732,7 +732,7 @@ void popup_system_error(H3270 *session, const char *title, const char *message, | @@ -732,7 +732,7 @@ void popup_system_error(H3270 *session, const char *title, const char *message, | ||
| 732 | trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); | 732 | trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); |
| 733 | 733 | ||
| 734 | va_start(args, fmt); | 734 | va_start(args, fmt); |
| 735 | - popup_handler(session,session->widget,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args); | 735 | + popup_handler(session,session->user_data,LIB3270_NOTIFY_ERROR,title ? title : _( "3270 Error" ), message,fmt,args); |
| 736 | va_end(args); | 736 | va_end(args); |
| 737 | } | 737 | } |
| 738 | 738 | ||
| @@ -857,7 +857,7 @@ LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const c | @@ -857,7 +857,7 @@ LIB3270_EXPORT void lib3270_popup_va(H3270 *session, LIB3270_NOTIFY id , const c | ||
| 857 | 857 | ||
| 858 | trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); | 858 | trace("%s: title=%s msg=%s",__FUNCTION__,"3270 Error",message); |
| 859 | 859 | ||
| 860 | - popup_handler(session,session->widget,id,title ? title : _( "3270 Error" ), message,fmt,args); | 860 | + popup_handler(session,session->user_data,id,title ? title : _( "3270 Error" ), message,fmt,args); |
| 861 | } | 861 | } |
| 862 | 862 | ||
| 863 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr) | 863 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr) |
src/lib3270/session.c
| @@ -320,9 +320,14 @@ LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) | @@ -320,9 +320,14 @@ LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) | ||
| 320 | return lib3270_session_new(""); | 320 | return lib3270_session_new(""); |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | -LIB3270_EXPORT void * lib3270_get_widget(H3270 *h) | 323 | +LIB3270_EXPORT void lib3270_set_user_data(H3270 *h, void *ptr) |
| 324 | { | 324 | { |
| 325 | CHECK_SESSION_HANDLE(h); | 325 | CHECK_SESSION_HANDLE(h); |
| 326 | - return h->widget; | 326 | + h->user_data = ptr; |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | +LIB3270_EXPORT void * lib3270_get_user_data(H3270 *h) | ||
| 330 | +{ | ||
| 331 | + CHECK_SESSION_HANDLE(h); | ||
| 332 | + return h->user_data; | ||
| 333 | +} |
src/plugins/rx3270/pluginmain.cc
| @@ -658,14 +658,14 @@ extern "C" | @@ -658,14 +658,14 @@ extern "C" | ||
| 658 | 658 | ||
| 659 | int plugin::set_copy(const char *text) | 659 | int plugin::set_copy(const char *text) |
| 660 | { | 660 | { |
| 661 | - v3270_set_copy(GTK_WIDGET(lib3270_get_widget(hSession)),text); | 661 | + v3270_set_copy(GTK_WIDGET(lib3270_get_user_data(hSession)),text); |
| 662 | return 0; | 662 | return 0; |
| 663 | } | 663 | } |
| 664 | 664 | ||
| 665 | string plugin::get_copy(void) | 665 | string plugin::get_copy(void) |
| 666 | { | 666 | { |
| 667 | string rc; | 667 | string rc; |
| 668 | - gchar * ptr = v3270_get_copy(GTK_WIDGET(lib3270_get_widget(hSession))); | 668 | + gchar * ptr = v3270_get_copy(GTK_WIDGET(lib3270_get_user_data(hSession))); |
| 669 | 669 | ||
| 670 | if(ptr) | 670 | if(ptr) |
| 671 | { | 671 | { |
src/pw3270/v3270/draw.c
| @@ -379,7 +379,7 @@ void v3270_reload(GtkWidget *widget) | @@ -379,7 +379,7 @@ void v3270_reload(GtkWidget *widget) | ||
| 379 | 379 | ||
| 380 | void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned short attr, unsigned char cursor) | 380 | void v3270_update_char(H3270 *session, int addr, unsigned char chr, unsigned short attr, unsigned char cursor) |
| 381 | { | 381 | { |
| 382 | - v3270 * terminal = GTK_V3270(session->widget); | 382 | + v3270 * terminal = GTK_V3270(session->user_data); |
| 383 | cairo_t * cr; | 383 | cairo_t * cr; |
| 384 | GdkRectangle rect; | 384 | GdkRectangle rect; |
| 385 | int rows,cols; | 385 | int rows,cols; |
src/pw3270/v3270/oia.c
| @@ -711,7 +711,7 @@ static void draw_cursor_position(cairo_t *cr, GdkRectangle *rect, struct v3270_m | @@ -711,7 +711,7 @@ static void draw_cursor_position(cairo_t *cr, GdkRectangle *rect, struct v3270_m | ||
| 711 | 711 | ||
| 712 | void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr) | 712 | void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col, unsigned char c, unsigned short attr) |
| 713 | { | 713 | { |
| 714 | - v3270 * terminal = GTK_V3270(session->widget); | 714 | + v3270 * terminal = GTK_V3270(session->user_data); |
| 715 | GdkRectangle saved; | 715 | GdkRectangle saved; |
| 716 | 716 | ||
| 717 | if(!terminal->surface) | 717 | if(!terminal->surface) |
| @@ -1027,7 +1027,7 @@ void v3270_stop_timer(GtkWidget *widget) | @@ -1027,7 +1027,7 @@ void v3270_stop_timer(GtkWidget *widget) | ||
| 1027 | 1027 | ||
| 1028 | void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state) | 1028 | void v3270_update_ssl(H3270 *session, LIB3270_SSL_STATE state) |
| 1029 | { | 1029 | { |
| 1030 | - v3270 * terminal = GTK_V3270(session->widget); | 1030 | + v3270 * terminal = GTK_V3270(session->user_data); |
| 1031 | cairo_t * cr; | 1031 | cairo_t * cr; |
| 1032 | GdkRectangle * r; | 1032 | GdkRectangle * r; |
| 1033 | 1033 | ||
| @@ -1046,7 +1046,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | @@ -1046,7 +1046,7 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | ||
| 1046 | cairo_t *cr; | 1046 | cairo_t *cr; |
| 1047 | GdkRectangle *r; | 1047 | GdkRectangle *r; |
| 1048 | 1048 | ||
| 1049 | - v3270 *terminal = GTK_V3270(session->widget); | 1049 | + v3270 *terminal = GTK_V3270(session->user_data); |
| 1050 | 1050 | ||
| 1051 | if(!terminal->surface) | 1051 | if(!terminal->surface) |
| 1052 | return; | 1052 | return; |
src/pw3270/v3270/widget.c
| @@ -649,7 +649,7 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int heig | @@ -649,7 +649,7 @@ void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int heig | ||
| 649 | 649 | ||
| 650 | static void set_timer(H3270 *session, unsigned char on) | 650 | static void set_timer(H3270 *session, unsigned char on) |
| 651 | { | 651 | { |
| 652 | - GtkWidget *widget = GTK_WIDGET(session->widget); | 652 | + GtkWidget *widget = GTK_WIDGET(session->user_data); |
| 653 | 653 | ||
| 654 | if(on) | 654 | if(on) |
| 655 | v3270_start_timer(widget); | 655 | v3270_start_timer(widget); |
| @@ -666,52 +666,52 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value | @@ -666,52 +666,52 @@ static void update_toggle(H3270 *session, LIB3270_TOGGLE ix, unsigned char value | ||
| 666 | { | 666 | { |
| 667 | case LIB3270_TOGGLE_CURSOR_POS: | 667 | case LIB3270_TOGGLE_CURSOR_POS: |
| 668 | case LIB3270_TOGGLE_CROSSHAIR: | 668 | case LIB3270_TOGGLE_CROSSHAIR: |
| 669 | - v3270_reload(GTK_WIDGET(session->widget)); | ||
| 670 | - gtk_widget_queue_draw(GTK_WIDGET(session->widget)); | 669 | + v3270_reload(GTK_WIDGET(session->user_data)); |
| 670 | + gtk_widget_queue_draw(GTK_WIDGET(session->user_data)); | ||
| 671 | break; | 671 | break; |
| 672 | 672 | ||
| 673 | case LIB3270_TOGGLE_CURSOR_BLINK: | 673 | case LIB3270_TOGGLE_CURSOR_BLINK: |
| 674 | - GTK_V3270(session->widget)->cursor.show |= 1; | 674 | + GTK_V3270(session->user_data)->cursor.show |= 1; |
| 675 | break; | 675 | break; |
| 676 | 676 | ||
| 677 | case LIB3270_TOGGLE_INSERT: | 677 | case LIB3270_TOGGLE_INSERT: |
| 678 | - v3270_draw_ins_status(GTK_V3270(session->widget)); | ||
| 679 | - v3270_cursor_draw(GTK_V3270(session->widget)); | 678 | + v3270_draw_ins_status(GTK_V3270(session->user_data)); |
| 679 | + v3270_cursor_draw(GTK_V3270(session->user_data)); | ||
| 680 | break; | 680 | break; |
| 681 | 681 | ||
| 682 | case LIB3270_TOGGLE_BOLD: | 682 | case LIB3270_TOGGLE_BOLD: |
| 683 | - v3270_reload(GTK_WIDGET(session->widget)); | ||
| 684 | - gtk_widget_queue_draw(GTK_WIDGET(session->widget)); | 683 | + v3270_reload(GTK_WIDGET(session->user_data)); |
| 684 | + gtk_widget_queue_draw(GTK_WIDGET(session->user_data)); | ||
| 685 | break; | 685 | break; |
| 686 | 686 | ||
| 687 | case LIB3270_TOGGLE_FULL_SCREEN: | 687 | case LIB3270_TOGGLE_FULL_SCREEN: |
| 688 | if(value) | 688 | if(value) |
| 689 | - gtk_window_fullscreen(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(session->widget)))); | 689 | + gtk_window_fullscreen(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(session->user_data)))); |
| 690 | else | 690 | else |
| 691 | - gtk_window_unfullscreen(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(session->widget)))); | 691 | + gtk_window_unfullscreen(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(session->user_data)))); |
| 692 | } | 692 | } |
| 693 | #if GTK_CHECK_VERSION(2,26,0) | 693 | #if GTK_CHECK_VERSION(2,26,0) |
| 694 | - g_object_notify_by_pspec(G_OBJECT(session->widget), v3270_properties[PROP_TOGGLE+ix]); | 694 | + g_object_notify_by_pspec(G_OBJECT(session->user_data), v3270_properties[PROP_TOGGLE+ix]); |
| 695 | #else | 695 | #else |
| 696 | - g_object_notify(G_OBJECT(session->widget),name); | 696 | + g_object_notify(G_OBJECT(session->user_data),name); |
| 697 | #endif // GTK_CHECK_VERSION | 697 | #endif // GTK_CHECK_VERSION |
| 698 | 698 | ||
| 699 | - g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_TOGGLE_CHANGED], 0, (guint) ix, (gboolean) (value != 0), (gchar *) name); | 699 | + g_signal_emit(GTK_WIDGET(session->user_data), v3270_widget_signal[SIGNAL_TOGGLE_CHANGED], 0, (guint) ix, (gboolean) (value != 0), (gchar *) name); |
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | static void update_message(H3270 *session, LIB3270_MESSAGE id) | 702 | static void update_message(H3270 *session, LIB3270_MESSAGE id) |
| 703 | { | 703 | { |
| 704 | - g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_MESSAGE_CHANGED], 0, (gint) id); | 704 | + g_signal_emit(GTK_WIDGET(session->user_data), v3270_widget_signal[SIGNAL_MESSAGE_CHANGED], 0, (gint) id); |
| 705 | } | 705 | } |
| 706 | 706 | ||
| 707 | static void update_luname(H3270 *session, const char *name) | 707 | static void update_luname(H3270 *session, const char *name) |
| 708 | { | 708 | { |
| 709 | - v3270_update_luname(GTK_WIDGET(session->widget),name); | 709 | + v3270_update_luname(GTK_WIDGET(session->user_data),name); |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | static void select_cursor(H3270 *session, LIB3270_CURSOR id) | 712 | static void select_cursor(H3270 *session, LIB3270_CURSOR id) |
| 713 | { | 713 | { |
| 714 | - GtkWidget *widget = GTK_WIDGET(session->widget); | 714 | + GtkWidget *widget = GTK_WIDGET(session->user_data); |
| 715 | 715 | ||
| 716 | #if GTK_CHECK_VERSION(2,20,0) | 716 | #if GTK_CHECK_VERSION(2,20,0) |
| 717 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) | 717 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) |
| @@ -726,7 +726,7 @@ static void select_cursor(H3270 *session, LIB3270_CURSOR id) | @@ -726,7 +726,7 @@ static void select_cursor(H3270 *session, LIB3270_CURSOR id) | ||
| 726 | 726 | ||
| 727 | static void ctlr_done(H3270 *session) | 727 | static void ctlr_done(H3270 *session) |
| 728 | { | 728 | { |
| 729 | - GtkWidget *widget = GTK_WIDGET(session->widget); | 729 | + GtkWidget *widget = GTK_WIDGET(session->user_data); |
| 730 | 730 | ||
| 731 | #if GTK_CHECK_VERSION(2,20,0) | 731 | #if GTK_CHECK_VERSION(2,20,0) |
| 732 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) | 732 | if(gtk_widget_get_realized(widget) && gtk_widget_get_has_window(widget)) |
| @@ -741,7 +741,7 @@ static void ctlr_done(H3270 *session) | @@ -741,7 +741,7 @@ static void ctlr_done(H3270 *session) | ||
| 741 | 741 | ||
| 742 | static void update_connect(H3270 *session, unsigned char connected) | 742 | static void update_connect(H3270 *session, unsigned char connected) |
| 743 | { | 743 | { |
| 744 | - v3270 *widget = GTK_V3270(session->widget); | 744 | + v3270 *widget = GTK_V3270(session->user_data); |
| 745 | 745 | ||
| 746 | trace("%s - %s",__FUNCTION__,connected ? "Connected" : "Disconnected"); | 746 | trace("%s - %s",__FUNCTION__,connected ? "Connected" : "Disconnected"); |
| 747 | 747 | ||
| @@ -770,23 +770,23 @@ static void update_connect(H3270 *session, unsigned char connected) | @@ -770,23 +770,23 @@ static void update_connect(H3270 *session, unsigned char connected) | ||
| 770 | static void update_screen_size(H3270 *session,unsigned short rows, unsigned short cols) | 770 | static void update_screen_size(H3270 *session,unsigned short rows, unsigned short cols) |
| 771 | { | 771 | { |
| 772 | // trace("Widget %p changes to %dx%d",session->widget,cols,rows); | 772 | // trace("Widget %p changes to %dx%d",session->widget,cols,rows); |
| 773 | - v3270_reload(GTK_WIDGET(session->widget)); | ||
| 774 | - gtk_widget_queue_draw(GTK_WIDGET(session->widget)); | 773 | + v3270_reload(GTK_WIDGET(session->user_data)); |
| 774 | + gtk_widget_queue_draw(GTK_WIDGET(session->user_data)); | ||
| 775 | } | 775 | } |
| 776 | 776 | ||
| 777 | static void update_model(H3270 *session, const char *name, int model, int rows, int cols) | 777 | static void update_model(H3270 *session, const char *name, int model, int rows, int cols) |
| 778 | { | 778 | { |
| 779 | #if GTK_CHECK_VERSION(2,26,0) | 779 | #if GTK_CHECK_VERSION(2,26,0) |
| 780 | - g_object_notify_by_pspec(G_OBJECT(session->widget), v3270_properties[PROP_MODEL]); | 780 | + g_object_notify_by_pspec(G_OBJECT(session->user_data), v3270_properties[PROP_MODEL]); |
| 781 | #else | 781 | #else |
| 782 | - g_object_notify(G_OBJECT(session->widget),"model"); | 782 | + g_object_notify(G_OBJECT(session->user_data),"model"); |
| 783 | #endif // GTK_CHECK_VERSION | 783 | #endif // GTK_CHECK_VERSION |
| 784 | - g_signal_emit(GTK_WIDGET(session->widget),v3270_widget_signal[SIGNAL_MODEL_CHANGED], 0, (guint) model, name); | 784 | + g_signal_emit(GTK_WIDGET(session->user_data),v3270_widget_signal[SIGNAL_MODEL_CHANGED], 0, (guint) model, name); |
| 785 | } | 785 | } |
| 786 | 786 | ||
| 787 | static void changed(H3270 *session, int offset, int len) | 787 | static void changed(H3270 *session, int offset, int len) |
| 788 | { | 788 | { |
| 789 | - GtkWidget * widget = session->widget; | 789 | + GtkWidget * widget = session->user_data; |
| 790 | GtkAccessible * obj = GTK_V3270(widget)->accessible; | 790 | GtkAccessible * obj = GTK_V3270(widget)->accessible; |
| 791 | 791 | ||
| 792 | #ifdef WIN32 | 792 | #ifdef WIN32 |
| @@ -845,7 +845,7 @@ static void changed(H3270 *session, int offset, int len) | @@ -845,7 +845,7 @@ static void changed(H3270 *session, int offset, int len) | ||
| 845 | 845 | ||
| 846 | static void set_selection(H3270 *session, unsigned char status) | 846 | static void set_selection(H3270 *session, unsigned char status) |
| 847 | { | 847 | { |
| 848 | - GtkWidget * widget = GTK_WIDGET(session->widget); | 848 | + GtkWidget * widget = GTK_WIDGET(session->user_data); |
| 849 | 849 | ||
| 850 | #if GTK_CHECK_VERSION(2,26,0) | 850 | #if GTK_CHECK_VERSION(2,26,0) |
| 851 | g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties[PROP_SELECTION]); | 851 | g_object_notify_by_pspec(G_OBJECT(widget), v3270_properties[PROP_SELECTION]); |
| @@ -859,7 +859,7 @@ static void set_selection(H3270 *session, unsigned char status) | @@ -859,7 +859,7 @@ static void set_selection(H3270 *session, unsigned char status) | ||
| 859 | static void update_selection(H3270 *session, int start, int end) | 859 | static void update_selection(H3270 *session, int start, int end) |
| 860 | { | 860 | { |
| 861 | // Selected region changed | 861 | // Selected region changed |
| 862 | - GtkWidget * widget = GTK_WIDGET(session->widget); | 862 | + GtkWidget * widget = GTK_WIDGET(session->user_data); |
| 863 | GtkAccessible * atk_obj = GTK_V3270(widget)->accessible; | 863 | GtkAccessible * atk_obj = GTK_V3270(widget)->accessible; |
| 864 | 864 | ||
| 865 | if(atk_obj) | 865 | if(atk_obj) |
| @@ -869,7 +869,7 @@ static void update_selection(H3270 *session, int start, int end) | @@ -869,7 +869,7 @@ static void update_selection(H3270 *session, int start, int end) | ||
| 869 | 869 | ||
| 870 | static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text) | 870 | static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text) |
| 871 | { | 871 | { |
| 872 | - g_signal_emit( GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_MESSAGE], 0, | 872 | + g_signal_emit( GTK_WIDGET(session->user_data), v3270_widget_signal[SIGNAL_MESSAGE], 0, |
| 873 | (int) id, | 873 | (int) id, |
| 874 | (gchar *) title, | 874 | (gchar *) title, |
| 875 | (gchar *) message, | 875 | (gchar *) message, |
| @@ -879,7 +879,7 @@ static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const | @@ -879,7 +879,7 @@ static void message(H3270 *session, LIB3270_NOTIFY id , const char *title, const | ||
| 879 | 879 | ||
| 880 | static int emit_print_signal(H3270 *session) | 880 | static int emit_print_signal(H3270 *session) |
| 881 | { | 881 | { |
| 882 | - g_signal_emit(GTK_WIDGET(session->widget), v3270_widget_signal[SIGNAL_PRINT], 0); | 882 | + g_signal_emit(GTK_WIDGET(session->user_data), v3270_widget_signal[SIGNAL_PRINT], 0); |
| 883 | return 0; | 883 | return 0; |
| 884 | } | 884 | } |
| 885 | 885 | ||
| @@ -910,7 +910,7 @@ static void v3270_init(v3270 *widget) | @@ -910,7 +910,7 @@ static void v3270_init(v3270 *widget) | ||
| 910 | return; | 910 | return; |
| 911 | } | 911 | } |
| 912 | 912 | ||
| 913 | - widget->host->widget = widget; | 913 | + widget->host->user_data = widget; |
| 914 | 914 | ||
| 915 | widget->host->update = v3270_update_char; | 915 | widget->host->update = v3270_update_char; |
| 916 | widget->host->changed = changed; | 916 | widget->host->changed = changed; |
| @@ -1650,11 +1650,11 @@ GtkWidget * v3270_get_default_widget(void) | @@ -1650,11 +1650,11 @@ GtkWidget * v3270_get_default_widget(void) | ||
| 1650 | return NULL; | 1650 | return NULL; |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
| 1653 | - if(!(hSession->widget && GTK_IS_V3270(hSession->widget))) | 1653 | + if(!(hSession->user_data && GTK_IS_V3270(hSession->user_data))) |
| 1654 | { | 1654 | { |
| 1655 | g_warning("No widget on default session on %s",__FUNCTION__); | 1655 | g_warning("No widget on default session on %s",__FUNCTION__); |
| 1656 | return NULL; | 1656 | return NULL; |
| 1657 | } | 1657 | } |
| 1658 | 1658 | ||
| 1659 | - return GTK_WIDGET(hSession->widget); | 1659 | + return GTK_WIDGET(hSession->user_data); |
| 1660 | } | 1660 | } |