Commit f0fc99bd9d89da26631312412b25554db1235f67
1 parent
32c52dce
Exists in
master
and in
1 other branch
Working in new FT settings dialog.
Showing
3 changed files
with
36 additions
and
0 deletions
Show diff stats
src/include/v3270/filetransfer.h
| ... | ... | @@ -99,6 +99,7 @@ |
| 99 | 99 | LIB3270_EXPORT void v3270_ft_settings_update(GtkWidget *widget); |
| 100 | 100 | |
| 101 | 101 | LIB3270_EXPORT void v3270_ft_settings_set_options(GtkWidget *widget, LIB3270_FT_OPTION options); |
| 102 | + LIB3270_EXPORT gboolean v3270_ft_settings_equals(GtkWidget *widget, GObject *activity); | |
| 102 | 103 | |
| 103 | 104 | // FT Activity widget |
| 104 | 105 | #define G_TYPE_V3270_FT_ACTIVITY (V3270FTActivity_get_type ()) | ... | ... |
src/v3270ft/dialog.c
| ... | ... | @@ -124,6 +124,28 @@ static void update_clicked(GtkButton G_GNUC_UNUSED(*button), V3270FTDialog *widg |
| 124 | 124 | |
| 125 | 125 | static void insert_clicked(GtkButton G_GNUC_UNUSED(*button), V3270FTDialog *widget) |
| 126 | 126 | { |
| 127 | + GtkTreeIter iter; | |
| 128 | + GtkTreeModel * model = gtk_tree_view_get_model(widget->queue); | |
| 129 | + | |
| 130 | + if(gtk_tree_model_get_iter_first(model,&iter)) | |
| 131 | + { | |
| 132 | + do | |
| 133 | + { | |
| 134 | + GObject * activity = NULL; | |
| 135 | + gtk_tree_model_get(model, &iter, 0, &activity, -1); | |
| 136 | + | |
| 137 | + if(activity && v3270_ft_settings_equals(widget->settings,activity)) | |
| 138 | + { | |
| 139 | + debug("%s: Activity already inserted",__FUNCTION__); | |
| 140 | + return; | |
| 141 | + } | |
| 142 | + | |
| 143 | + } | |
| 144 | + while(gtk_tree_model_iter_next(model,&iter)); | |
| 145 | + } | |
| 146 | + | |
| 147 | + // Not found, insert it. | |
| 148 | + | |
| 127 | 149 | } |
| 128 | 150 | |
| 129 | 151 | static void V3270FTDialog_init(V3270FTDialog *widget) | ... | ... |
src/v3270ft/settings.c
| ... | ... | @@ -549,6 +549,19 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP |
| 549 | 549 | |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | + LIB3270_EXPORT gboolean v3270_ft_settings_equals(GtkWidget *widget, GObject *activity) | |
| 553 | + { | |
| 554 | + V3270FTSettings * settings = GTK_V3270_FT_SETTINGS(widget); | |
| 555 | + | |
| 556 | + if(strcmp(gtk_entry_get_text(settings->file.local),v3270_ft_activity_get_local_filename(activity))) | |
| 557 | + return FALSE; | |
| 558 | + | |
| 559 | + if(strcmp(gtk_entry_get_text(settings->file.remote),v3270_ft_activity_get_remote_filename(activity))) | |
| 560 | + return FALSE; | |
| 561 | + | |
| 562 | + return TRUE; | |
| 563 | + } | |
| 564 | + | |
| 552 | 565 | LIB3270_EXPORT void v3270_ft_settings_update(GtkWidget *widget) |
| 553 | 566 | { |
| 554 | 567 | int ix; | ... | ... |