Commit 3fdb5c4e02a2827a8835b6cf22bbc9dd3db7f55e
1 parent
3d7c20ac
Exists in
master
and in
1 other branch
Working on the FT dialog box.
Showing
2 changed files
with
40 additions
and
12 deletions
Show diff stats
src/v3270ft/dialog.c
... | ... | @@ -40,7 +40,6 @@ |
40 | 40 | GtkWidget * settings; |
41 | 41 | |
42 | 42 | struct { |
43 | - GtkWidget * valid; | |
44 | 43 | GtkWidget * insert; |
45 | 44 | GtkWidget * update; |
46 | 45 | GtkWidget * remove; |
... | ... | @@ -91,7 +90,15 @@ void activity_selected(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn G |
91 | 90 | static void validity_changed(GtkWidget G_GNUC_UNUSED(*settings), gboolean valid, V3270FTDialog *widget) |
92 | 91 | { |
93 | 92 | debug("The file transfer settings are now %s",valid ? "valid" : "invalid"); |
94 | - gtk_widget_set_sensitive(widget->button.valid,valid); | |
93 | + gtk_widget_set_sensitive(widget->button.insert,valid); | |
94 | + gtk_widget_set_sensitive(widget->button.update,valid); | |
95 | +} | |
96 | + | |
97 | +static void has_activity_changed(GtkWidget G_GNUC_UNUSED(*settings), gboolean have_activity, V3270FTDialog *widget) | |
98 | +{ | |
99 | + gtk_widget_set_sensitive(widget->button.reset,have_activity); | |
100 | + gtk_widget_set_sensitive(widget->button.update,have_activity); | |
101 | + gtk_widget_set_sensitive(widget->button.remove,have_activity); | |
95 | 102 | } |
96 | 103 | |
97 | 104 | static void reset_clicked(GtkButton G_GNUC_UNUSED(*button), V3270FTDialog *widget) |
... | ... | @@ -182,6 +189,7 @@ static void V3270FTDialog_init(V3270FTDialog *widget) |
182 | 189 | { |
183 | 190 | widget->settings = v3270_ft_settings_new(); |
184 | 191 | g_signal_connect(G_OBJECT(widget->settings),"validity",G_CALLBACK(validity_changed),widget); |
192 | + g_signal_connect(G_OBJECT(widget->settings),"has-activity",G_CALLBACK(has_activity_changed),widget); | |
185 | 193 | |
186 | 194 | // Does the dialog have header bar? |
187 | 195 | GtkHeaderBar * header = GTK_HEADER_BAR(gtk_dialog_get_header_bar(GTK_DIALOG(widget))); |
... | ... | @@ -206,28 +214,28 @@ static void V3270FTDialog_init(V3270FTDialog *widget) |
206 | 214 | |
207 | 215 | // Create action buttons |
208 | 216 | { |
209 | - widget->button.valid = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,6); | |
217 | + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,6); | |
210 | 218 | |
211 | - g_object_set(G_OBJECT(widget->button.valid),"margin-top",6,NULL); | |
219 | + g_object_set(G_OBJECT(box),"margin-top",6,NULL); | |
212 | 220 | |
213 | - widget->button.reset = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Reset"),FALSE,FALSE,0); | |
221 | + widget->button.reset = v3270_box_pack_end(box,gtk_button_new_with_mnemonic("_Reset"),FALSE,FALSE,0); | |
214 | 222 | g_signal_connect(widget->button.reset,"clicked",G_CALLBACK(reset_clicked),widget); |
215 | 223 | |
216 | - widget->button.update = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Update"),FALSE,FALSE,0); | |
224 | + widget->button.update = v3270_box_pack_end(box,gtk_button_new_with_mnemonic("_Update"),FALSE,FALSE,0); | |
217 | 225 | g_signal_connect(widget->button.update,"clicked",G_CALLBACK(update_clicked),widget); |
218 | 226 | |
219 | - widget->button.insert = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Delete"),FALSE,FALSE,0); | |
220 | - g_signal_connect(widget->button.insert,"clicked",G_CALLBACK(remove_clicked),widget); | |
227 | + widget->button.remove = v3270_box_pack_end(box,gtk_button_new_with_mnemonic("_Delete"),FALSE,FALSE,0); | |
228 | + g_signal_connect(widget->button.remove,"clicked",G_CALLBACK(remove_clicked),widget); | |
221 | 229 | |
222 | - widget->button.insert = v3270_box_pack_end(widget->button.valid,gtk_button_new_with_mnemonic("_Insert"),FALSE,FALSE,0); | |
230 | + widget->button.insert = v3270_box_pack_end(box,gtk_button_new_with_mnemonic("_Insert"),FALSE,FALSE,0); | |
223 | 231 | g_signal_connect(widget->button.insert,"clicked",G_CALLBACK(insert_clicked),widget); |
224 | 232 | |
225 | 233 | gtk_widget_set_sensitive(widget->button.update,FALSE); |
226 | 234 | gtk_widget_set_sensitive(widget->button.remove,FALSE); |
235 | + gtk_widget_set_sensitive(widget->button.insert,FALSE); | |
227 | 236 | gtk_widget_set_sensitive(widget->button.reset,FALSE); |
228 | 237 | |
229 | - gtk_box_pack_start(GTK_BOX(container),widget->button.valid,FALSE,FALSE,0); | |
230 | - gtk_widget_set_sensitive(widget->button.valid,FALSE); | |
238 | + gtk_box_pack_start(GTK_BOX(container),box,FALSE,FALSE,0); | |
231 | 239 | |
232 | 240 | } |
233 | 241 | ... | ... |
src/v3270ft/settings.c
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | struct |
43 | 43 | { |
44 | 44 | void (*validity)(GtkWidget *, gboolean); |
45 | + void (*has_activity)(GtkWidget *, gboolean); | |
45 | 46 | } signal; |
46 | 47 | |
47 | 48 | }; |
... | ... | @@ -88,7 +89,8 @@ |
88 | 89 | |
89 | 90 | enum _SIGNALS |
90 | 91 | { |
91 | - V3270_FT_SETTINGS_VALIDITY_SIGNAL, ///< @brief Indicates if the dialog contents is valid. | |
92 | + V3270_FT_SETTINGS_VALIDITY_SIGNAL, ///< @brief Indicates if the dialog contents is valid. | |
93 | + V3270_FT_SETTINGS_HAS_ACTIVITY_SIGNAL, ///< @brief Indicates fi the dialog has an activity. | |
92 | 94 | |
93 | 95 | V3270_FT_SETTINGS_LAST_SIGNAL |
94 | 96 | }; |
... | ... | @@ -102,11 +104,17 @@ |
102 | 104 | debug("%s",__FUNCTION__); |
103 | 105 | } |
104 | 106 | |
107 | +static void V3270FTSettings_has_activity(GtkWidget G_GNUC_UNUSED(*widget), gboolean G_GNUC_UNUSED(is_valid)) | |
108 | + { | |
109 | + debug("%s",__FUNCTION__); | |
110 | + } | |
111 | + | |
105 | 112 | static void V3270FTSettings_class_init(G_GNUC_UNUSED V3270FTSettingsClass *klass) |
106 | 113 | { |
107 | 114 | GObjectClass * gobject_class = G_OBJECT_CLASS(klass); |
108 | 115 | |
109 | 116 | klass->signal.validity = V3270FTSettings_validity; |
117 | + klass->signal.has_activity = V3270FTSettings_has_activity; | |
110 | 118 | |
111 | 119 | v3270_ft_settings_signals[V3270_FT_SETTINGS_VALIDITY_SIGNAL] = |
112 | 120 | g_signal_new( "validity", |
... | ... | @@ -118,6 +126,17 @@ |
118 | 126 | G_TYPE_NONE, 1, G_TYPE_BOOLEAN); |
119 | 127 | |
120 | 128 | |
129 | + v3270_ft_settings_signals[V3270_FT_SETTINGS_HAS_ACTIVITY_SIGNAL] = | |
130 | + g_signal_new( "has-activity", | |
131 | + G_OBJECT_CLASS_TYPE (gobject_class), | |
132 | + G_SIGNAL_RUN_FIRST, | |
133 | + G_STRUCT_OFFSET (V3270FTSettingsClass, signal.has_activity), | |
134 | + NULL, NULL, | |
135 | + v3270ft_VOID__VOID_BOOLEAN, | |
136 | + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); | |
137 | + | |
138 | + | |
139 | + | |
121 | 140 | } |
122 | 141 | |
123 | 142 | static GtkWidget * create_label(V3270FTSettings *widget, const gchar *mnemonic, gint left, gint top) |
... | ... | @@ -526,6 +545,7 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP |
526 | 545 | { |
527 | 546 | GTK_V3270_FT_SETTINGS(widget)->activity = activity; |
528 | 547 | v3270_ft_settings_reset(widget); |
548 | + g_signal_emit(widget, v3270_ft_settings_signals[V3270_FT_SETTINGS_HAS_ACTIVITY_SIGNAL], 0, (activity == NULL ? FALSE : TRUE)); | |
529 | 549 | } |
530 | 550 | |
531 | 551 | LIB3270_EXPORT GObject * v3270_ft_settings_get_activity(GtkWidget *widget) | ... | ... |