Commit 2ea451a5a1b3ba885c91c7a64be1fa41a6651b06
1 parent
1e84a9de
Exists in
master
and in
1 other branch
Writing the FT Worker widget.
Showing
5 changed files
with
55 additions
and
5 deletions
Show diff stats
src/filetransfer/activity.c
src/filetransfer/worker.c
... | ... | @@ -45,9 +45,10 @@ |
45 | 45 | { |
46 | 46 | GtkGrid parent; |
47 | 47 | |
48 | - GtkProgressBar * pbar; ///< @brief Progress bar. | |
48 | + GtkProgressBar * pbar; ///< @brief Progress bar. | |
49 | + GObject * activity; ///< @brief File transfer activity; | |
49 | 50 | |
50 | - GtkEntry * field[PROGRESS_FIELD_COUNT]; ///< @brief Transfer information widgets. | |
51 | + GtkEntry * field[PROGRESS_FIELD_COUNT]; ///< @brief Transfer information widgets. | |
51 | 52 | |
52 | 53 | |
53 | 54 | }; |
... | ... | @@ -60,8 +61,13 @@ |
60 | 61 | { |
61 | 62 | debug("%s",__FUNCTION__); |
62 | 63 | |
63 | - // V3270FTWorker * worker = GTK_V3270_FT_WORKER(object); | |
64 | + V3270FTWorker * worker = GTK_V3270_FT_WORKER(object); | |
64 | 65 | |
66 | + if(worker->activity) | |
67 | + { | |
68 | + g_object_unref(worker->activity); | |
69 | + worker->activity = NULL; | |
70 | + } | |
65 | 71 | |
66 | 72 | G_OBJECT_CLASS(V3270FTWorker_parent_class)->finalize(object); |
67 | 73 | |
... | ... | @@ -115,7 +121,7 @@ |
115 | 121 | gtk_box_set_homogeneous(GTK_BOX(views),TRUE); |
116 | 122 | gtk_grid_attach(GTK_GRID(widget),views,0,2,10,1); |
117 | 123 | g_object_set(G_OBJECT(views),"margin-top",8,NULL); |
118 | - g_object_set(G_OBJECT(views),"margin-botton",8,NULL); | |
124 | + g_object_set(G_OBJECT(views),"margin-bottom",8,NULL); | |
119 | 125 | |
120 | 126 | { |
121 | 127 | // Left options |
... | ... | @@ -168,3 +174,37 @@ |
168 | 174 | return GTK_WIDGET(g_object_new(GTK_TYPE_V3270_FT_WORKER, NULL)); |
169 | 175 | } |
170 | 176 | |
177 | + LIB3270_EXPORT void v3270_ft_worker_set_activity(GtkWidget *widget, GObject *activity) | |
178 | + { | |
179 | + size_t ix; | |
180 | + | |
181 | + V3270FTWorker * worker = GTK_V3270_FT_WORKER(widget); | |
182 | + | |
183 | + if(worker->activity) | |
184 | + { | |
185 | + g_object_unref(worker->activity); | |
186 | + worker->activity = NULL; | |
187 | + } | |
188 | + | |
189 | + if(activity) | |
190 | + { | |
191 | + worker->activity = activity; | |
192 | + g_object_ref(worker->activity); | |
193 | + | |
194 | + gtk_entry_set_text(worker->field[PROGRESS_FIELD_LOCAL],v3270_ft_activity_get_local_filename(activity)); | |
195 | + gtk_entry_set_text(worker->field[PROGRESS_FIELD_REMOTE],v3270_ft_activity_get_remote_filename(activity)); | |
196 | + | |
197 | + } | |
198 | + else | |
199 | + { | |
200 | + gtk_entry_set_text(worker->field[PROGRESS_FIELD_LOCAL],""); | |
201 | + gtk_entry_set_text(worker->field[PROGRESS_FIELD_REMOTE],""); | |
202 | + } | |
203 | + | |
204 | + for(ix = PROGRESS_FIELD_TOTAL; ix < PROGRESS_FIELD_COUNT; ix++) | |
205 | + { | |
206 | + gtk_entry_set_text(worker->field[ix],""); | |
207 | + } | |
208 | + | |
209 | + } | |
210 | + | ... | ... |
src/include/v3270/filetransfer.h
... | ... | @@ -158,5 +158,6 @@ |
158 | 158 | typedef struct _V3270FTWorkerClass V3270FTWorkerClass; |
159 | 159 | |
160 | 160 | LIB3270_EXPORT GtkWidget * v3270_ft_worker_new(); |
161 | + LIB3270_EXPORT void v3270_ft_worker_set_activity(GtkWidget *widget, GObject *activity); | |
161 | 162 | |
162 | 163 | #endif // V3270FT_H_INCLUDED | ... | ... |
src/testprogram/testprogram.c
... | ... | @@ -153,6 +153,12 @@ static void ft_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) |
153 | 153 | GtkWidget * worker = v3270_ft_worker_new(); |
154 | 154 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),worker,TRUE,TRUE,2); |
155 | 155 | |
156 | + GObject * activity = v3270_ft_activity_new(); | |
157 | + v3270_ft_activity_set_local_filename(activity,"local_file"); | |
158 | + v3270_ft_activity_set_remote_filename(activity,"remove_file"); | |
159 | + v3270_ft_worker_set_activity(worker,activity); | |
160 | + g_object_unref(activity); | |
161 | + | |
156 | 162 | // GtkWidget * dialog = v3270ftprogress_new(); |
157 | 163 | // GtkWidget * dialog = v3270_ft_dialog_new(terminal); |
158 | 164 | ... | ... |
v3270.cbp
... | ... | @@ -121,6 +121,9 @@ |
121 | 121 | <Unit filename="src/filetransfer/v3270ftprogress.c"> |
122 | 122 | <Option compilerVar="CC" /> |
123 | 123 | </Unit> |
124 | + <Unit filename="src/filetransfer/worker.c"> | |
125 | + <Option compilerVar="CC" /> | |
126 | + </Unit> | |
124 | 127 | <Unit filename="src/include/config.h" /> |
125 | 128 | <Unit filename="src/include/config.h.in" /> |
126 | 129 | <Unit filename="src/include/hostselect.h" /> | ... | ... |