Commit 1bd07549f6c809d31851f3cabf747c6bc2b1546e
1 parent
13c0f3e6
Exists in
master
and in
1 other branch
Fixes on FT dialog.
Showing
5 changed files
with
61 additions
and
4 deletions
Show diff stats
src/dialogs/print/print.c
src/include/v3270/filetransfer.h
| ... | ... | @@ -141,6 +141,9 @@ |
| 141 | 141 | typedef struct _V3270FTDialog V3270FTDialog; |
| 142 | 142 | typedef struct _V3270FTDialogClass V3270FTDialogClass; |
| 143 | 143 | |
| 144 | + LIB3270_EXPORT GtkWidget * v3270_ft_dialog_new(GtkWidget *parent); | |
| 145 | + LIB3270_EXPORT void v3270_ft_dialog_set_session(GtkWidget *widget, H3270 *hSession); | |
| 146 | + | |
| 144 | 147 | G_END_DECLS |
| 145 | 148 | |
| 146 | 149 | #endif // V3270FT_H_INCLUDED | ... | ... |
src/v3270ft/activity.c
| ... | ... | @@ -78,6 +78,8 @@ |
| 78 | 78 | g_free(activity->file.local); |
| 79 | 79 | g_free(activity->file.remote); |
| 80 | 80 | |
| 81 | + G_OBJECT_CLASS(V3270FTActivity_parent_class)->dispose(object); | |
| 82 | + | |
| 81 | 83 | } |
| 82 | 84 | |
| 83 | 85 | static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) | ... | ... |
src/v3270ft/activitylist.c
| ... | ... | @@ -73,6 +73,8 @@ |
| 73 | 73 | g_free(list->filename); |
| 74 | 74 | list->filename = NULL; |
| 75 | 75 | |
| 76 | + G_OBJECT_CLASS(V3270FTActivityList_parent_class)->dispose(object); | |
| 77 | + | |
| 76 | 78 | } |
| 77 | 79 | |
| 78 | 80 | static void V3270FTActivityList_has_file(GtkWidget G_GNUC_UNUSED(*widget), gboolean G_GNUC_UNUSED(has_file)) |
| ... | ... | @@ -186,7 +188,7 @@ |
| 186 | 188 | } |
| 187 | 189 | |
| 188 | 190 | |
| 189 | - static void element_start(GMarkupParseContext *context, const gchar *element_name, const gchar **names,const gchar **values, V3270FTActivityList *widget, GError **error) | |
| 191 | + static void element_start(GMarkupParseContext *context, const gchar *element_name, const gchar G_GNUC_UNUSED(**names),const gchar G_GNUC_UNUSED(**values), V3270FTActivityList *widget, GError G_GNUC_UNUSED(**error)) | |
| 190 | 192 | { |
| 191 | 193 | debug("%s(%s)",__FUNCTION__, element_name); |
| 192 | 194 | if(!g_ascii_strcasecmp(element_name,"entry")) | ... | ... |
src/v3270ft/dialog.c
| ... | ... | @@ -37,9 +37,13 @@ |
| 37 | 37 | { |
| 38 | 38 | GtkDialog parent; |
| 39 | 39 | |
| 40 | - GtkWidget * settings; | |
| 40 | + GtkWidget * settings; | |
| 41 | 41 | |
| 42 | - struct { | |
| 42 | + H3270 * hSession; | |
| 43 | + const void * stHandle; | |
| 44 | + | |
| 45 | + struct | |
| 46 | + { | |
| 43 | 47 | GtkWidget * insert; |
| 44 | 48 | GtkWidget * update; |
| 45 | 49 | GtkWidget * remove; |
| ... | ... | @@ -47,7 +51,8 @@ |
| 47 | 51 | GtkWidget * begin; |
| 48 | 52 | } button; |
| 49 | 53 | |
| 50 | - struct { | |
| 54 | + struct | |
| 55 | + { | |
| 51 | 56 | GtkWidget * view; |
| 52 | 57 | GtkWidget * load; |
| 53 | 58 | GtkWidget * save; |
| ... | ... | @@ -65,8 +70,24 @@ |
| 65 | 70 | |
| 66 | 71 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 67 | 72 | |
| 73 | +static void finalize(GObject *object) | |
| 74 | +{ | |
| 75 | + debug("%s",__FUNCTION__); | |
| 76 | + | |
| 77 | + V3270FTDialog * dialog = GTK_V3270_FT_DIALOG(object); | |
| 78 | + | |
| 79 | + if(dialog->hSession && dialog->stHandle) | |
| 80 | + { | |
| 81 | + lib3270_unregister_schange(dialog->hSession,LIB3270_STATE_CONNECT,dialog->stHandle); | |
| 82 | + dialog->stHandle = NULL; | |
| 83 | + } | |
| 84 | + | |
| 85 | + G_OBJECT_CLASS(V3270FTDialog_parent_class)->finalize(object); | |
| 86 | +} | |
| 87 | + | |
| 68 | 88 | static void V3270FTDialog_class_init(G_GNUC_UNUSED V3270FTDialogClass *klass) |
| 69 | 89 | { |
| 90 | + G_OBJECT_CLASS(klass)->finalize = finalize; | |
| 70 | 91 | } |
| 71 | 92 | |
| 72 | 93 | void activity_selected(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn G_GNUC_UNUSED(*column), V3270FTDialog *widget) |
| ... | ... | @@ -276,6 +297,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget) |
| 276 | 297 | GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL); |
| 277 | 298 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); |
| 278 | 299 | gtk_container_add(GTK_CONTAINER(scrolled),widget->queue.view); |
| 300 | + gtk_widget_set_size_request(scrolled,50,150); | |
| 279 | 301 | |
| 280 | 302 | gtk_widget_set_vexpand(scrolled,TRUE); |
| 281 | 303 | gtk_widget_set_hexpand(scrolled,TRUE); |
| ... | ... | @@ -321,6 +343,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget) |
| 321 | 343 | |
| 322 | 344 | // gtk_widget_set_sensitive(widget->button.begin,FALSE); |
| 323 | 345 | gtk_widget_set_tooltip_markup(widget->button.begin,_("Start transfer")); |
| 346 | + gtk_widget_set_sensitive(widget->button.begin,FALSE); | |
| 324 | 347 | |
| 325 | 348 | /* |
| 326 | 349 | #ifdef DEBUG |
| ... | ... | @@ -358,6 +381,31 @@ LIB3270_EXPORT GtkWidget * v3270_ft_dialog_new(GtkWidget *parent) |
| 358 | 381 | gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); |
| 359 | 382 | } |
| 360 | 383 | |
| 384 | + if(GTK_IS_V3270(parent)) | |
| 385 | + v3270_ft_dialog_set_session(dialog,v3270_get_session(parent)); | |
| 386 | + | |
| 361 | 387 | return dialog; |
| 362 | 388 | } |
| 363 | 389 | |
| 390 | +static void connect_changed(H3270 G_GNUC_UNUSED(*hSession), int state, void *widget) | |
| 391 | +{ | |
| 392 | + V3270FTDialog * dialog = GTK_V3270_FT_DIALOG( ((GtkWidget *) widget) ); | |
| 393 | + gtk_widget_set_sensitive(dialog->button.begin,state ? TRUE : FALSE); | |
| 394 | +} | |
| 395 | + | |
| 396 | +LIB3270_EXPORT void v3270_ft_dialog_set_session(GtkWidget *widget, H3270 *hSession) | |
| 397 | +{ | |
| 398 | + V3270FTDialog * dialog = GTK_V3270_FT_DIALOG(widget); | |
| 399 | + | |
| 400 | + if(dialog->hSession && dialog->stHandle) | |
| 401 | + { | |
| 402 | + lib3270_unregister_schange(dialog->hSession,LIB3270_STATE_CONNECT,dialog->stHandle); | |
| 403 | + dialog->stHandle = NULL; | |
| 404 | + } | |
| 405 | + | |
| 406 | + dialog->hSession = hSession; | |
| 407 | + dialog->stHandle = lib3270_register_schange(hSession,LIB3270_STATE_CONNECT,connect_changed,(void *) widget); | |
| 408 | + | |
| 409 | + gtk_widget_set_sensitive(dialog->button.begin,lib3270_is_connected(hSession) ? TRUE : FALSE); | |
| 410 | + | |
| 411 | +} | ... | ... |