Commit 1bd07549f6c809d31851f3cabf747c6bc2b1546e

Authored by Perry Werneck
1 parent 13c0f3e6
Exists in master and in 1 other branch develop

Fixes on FT dialog.

src/dialogs/print/print.c
@@ -180,6 +180,8 @@ @@ -180,6 +180,8 @@
180 180
181 } 181 }
182 182
  183 + G_OBJECT_CLASS(V3270PrintOperation_parent_class)->dispose(object);
  184 +
183 } 185 }
184 186
185 static void V3270PrintOperation_class_init(V3270PrintOperationClass *klass) 187 static void V3270PrintOperation_class_init(V3270PrintOperationClass *klass)
src/include/v3270/filetransfer.h
@@ -141,6 +141,9 @@ @@ -141,6 +141,9 @@
141 typedef struct _V3270FTDialog V3270FTDialog; 141 typedef struct _V3270FTDialog V3270FTDialog;
142 typedef struct _V3270FTDialogClass V3270FTDialogClass; 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 G_END_DECLS 147 G_END_DECLS
145 148
146 #endif // V3270FT_H_INCLUDED 149 #endif // V3270FT_H_INCLUDED
src/v3270ft/activity.c
@@ -78,6 +78,8 @@ @@ -78,6 +78,8 @@
78 g_free(activity->file.local); 78 g_free(activity->file.local);
79 g_free(activity->file.remote); 79 g_free(activity->file.remote);
80 80
  81 + G_OBJECT_CLASS(V3270FTActivity_parent_class)->dispose(object);
  82 +
81 } 83 }
82 84
83 static void set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec G_GNUC_UNUSED(*pspec)) 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,6 +73,8 @@
73 g_free(list->filename); 73 g_free(list->filename);
74 list->filename = NULL; 74 list->filename = NULL;
75 75
  76 + G_OBJECT_CLASS(V3270FTActivityList_parent_class)->dispose(object);
  77 +
76 } 78 }
77 79
78 static void V3270FTActivityList_has_file(GtkWidget G_GNUC_UNUSED(*widget), gboolean G_GNUC_UNUSED(has_file)) 80 static void V3270FTActivityList_has_file(GtkWidget G_GNUC_UNUSED(*widget), gboolean G_GNUC_UNUSED(has_file))
@@ -186,7 +188,7 @@ @@ -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 debug("%s(%s)",__FUNCTION__, element_name); 193 debug("%s(%s)",__FUNCTION__, element_name);
192 if(!g_ascii_strcasecmp(element_name,"entry")) 194 if(!g_ascii_strcasecmp(element_name,"entry"))
src/v3270ft/dialog.c
@@ -37,9 +37,13 @@ @@ -37,9 +37,13 @@
37 { 37 {
38 GtkDialog parent; 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 GtkWidget * insert; 47 GtkWidget * insert;
44 GtkWidget * update; 48 GtkWidget * update;
45 GtkWidget * remove; 49 GtkWidget * remove;
@@ -47,7 +51,8 @@ @@ -47,7 +51,8 @@
47 GtkWidget * begin; 51 GtkWidget * begin;
48 } button; 52 } button;
49 53
50 - struct { 54 + struct
  55 + {
51 GtkWidget * view; 56 GtkWidget * view;
52 GtkWidget * load; 57 GtkWidget * load;
53 GtkWidget * save; 58 GtkWidget * save;
@@ -65,8 +70,24 @@ @@ -65,8 +70,24 @@
65 70
66 /*--[ Implement ]------------------------------------------------------------------------------------*/ 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 static void V3270FTDialog_class_init(G_GNUC_UNUSED V3270FTDialogClass *klass) 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 void activity_selected(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn G_GNUC_UNUSED(*column), V3270FTDialog *widget) 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,6 +297,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget)
276 GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL); 297 GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL);
277 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); 298 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
278 gtk_container_add(GTK_CONTAINER(scrolled),widget->queue.view); 299 gtk_container_add(GTK_CONTAINER(scrolled),widget->queue.view);
  300 + gtk_widget_set_size_request(scrolled,50,150);
279 301
280 gtk_widget_set_vexpand(scrolled,TRUE); 302 gtk_widget_set_vexpand(scrolled,TRUE);
281 gtk_widget_set_hexpand(scrolled,TRUE); 303 gtk_widget_set_hexpand(scrolled,TRUE);
@@ -321,6 +343,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget) @@ -321,6 +343,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget)
321 343
322 // gtk_widget_set_sensitive(widget->button.begin,FALSE); 344 // gtk_widget_set_sensitive(widget->button.begin,FALSE);
323 gtk_widget_set_tooltip_markup(widget->button.begin,_("Start transfer")); 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 #ifdef DEBUG 349 #ifdef DEBUG
@@ -358,6 +381,31 @@ LIB3270_EXPORT GtkWidget * v3270_ft_dialog_new(GtkWidget *parent) @@ -358,6 +381,31 @@ LIB3270_EXPORT GtkWidget * v3270_ft_dialog_new(GtkWidget *parent)
358 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); 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 return dialog; 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 +}