Commit e6e16ddd18f1e16f83d8c55f80366181714818db
1 parent
10dbb6f7
Exists in
master
and in
1 other branch
Working on the new FT component.
Showing
5 changed files
with
73 additions
and
48 deletions
Show diff stats
src/include/internals.h
| @@ -58,10 +58,13 @@ | @@ -58,10 +58,13 @@ | ||
| 58 | return child; | 58 | return child; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | - G_GNUC_INTERNAL GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, GtkAlign align, gboolean expand, gboolean fill, guint padding); | ||
| 62 | - G_GNUC_INTERNAL GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, GtkAlign align, gboolean expand, gboolean fill, guint padding); | ||
| 63 | - G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_grid(GtkAlign align); | ||
| 64 | - G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title); | 61 | + G_GNUC_INTERNAL GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, GtkAlign align, gboolean expand, gboolean fill, guint padding); |
| 62 | + G_GNUC_INTERNAL GtkWidget * v3270_box_pack_frame(GtkWidget *box, GtkWidget *child, const gchar *title, GtkAlign align, gboolean expand, gboolean fill, guint padding); | ||
| 63 | + G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_grid(GtkAlign align); | ||
| 64 | + G_GNUC_INTERNAL GtkWidget * v3270_dialog_create_frame(GtkWidget * child, const gchar *title); | ||
| 65 | + | ||
| 66 | + G_GNUC_INTERNAL GtkWidget * v3270_activity_list_new(); | ||
| 67 | + G_GNUC_INTERNAL void v3270_activity_list_append(GtkWidget *widget, GObject *activity); | ||
| 65 | 68 | ||
| 66 | G_END_DECLS | 69 | G_END_DECLS |
| 67 | 70 |
src/include/v3270/filetransfer.h
| @@ -93,6 +93,7 @@ | @@ -93,6 +93,7 @@ | ||
| 93 | typedef struct _V3270FTSettingsClass V3270FTSettingsClass; | 93 | typedef struct _V3270FTSettingsClass V3270FTSettingsClass; |
| 94 | 94 | ||
| 95 | LIB3270_EXPORT GtkWidget * v3270_ft_settings_new(); | 95 | LIB3270_EXPORT GtkWidget * v3270_ft_settings_new(); |
| 96 | + LIB3270_EXPORT void v3270_ft_settings_set_activity(GtkWidget *widget, GObject *activity); | ||
| 96 | 97 | ||
| 97 | // FT Activity widget | 98 | // FT Activity widget |
| 98 | #define G_TYPE_V3270_FT_ACTIVITY (V3270FTActivity_get_type ()) | 99 | #define G_TYPE_V3270_FT_ACTIVITY (V3270FTActivity_get_type ()) |
src/v3270ft/activity.c
| @@ -159,3 +159,54 @@ | @@ -159,3 +159,54 @@ | ||
| 159 | g_free(*ptr); | 159 | g_free(*ptr); |
| 160 | *ptr = g_strdup(filename); | 160 | *ptr = g_strdup(filename); |
| 161 | } | 161 | } |
| 162 | + | ||
| 163 | + static void render_local(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) | ||
| 164 | + { | ||
| 165 | + V3270FTActivity * activity; | ||
| 166 | + gtk_tree_model_get(tree_model, iter, 0, &activity, -1); | ||
| 167 | + g_object_set(G_OBJECT(cell),"text",activity->file.local,NULL); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + static void render_remote(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) | ||
| 171 | + { | ||
| 172 | + V3270FTActivity * activity; | ||
| 173 | + gtk_tree_model_get(tree_model, iter, 0, &activity, -1); | ||
| 174 | + g_object_set(G_OBJECT(cell),"text",activity->file.remote,NULL); | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + GtkWidget * v3270_activity_list_new() | ||
| 178 | + { | ||
| 179 | + GtkTreeModel * model = GTK_TREE_MODEL(gtk_list_store_new(1,G_TYPE_OBJECT)); | ||
| 180 | + GtkWidget * widget = gtk_tree_view_new_with_model(model); | ||
| 181 | + | ||
| 182 | + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(widget),TRUE); | ||
| 183 | + gtk_tree_view_set_reorderable(GTK_TREE_VIEW(widget),TRUE); | ||
| 184 | + | ||
| 185 | + gtk_tree_view_insert_column_with_data_func( | ||
| 186 | + GTK_TREE_VIEW(widget), | ||
| 187 | + -1, | ||
| 188 | + _( "Local file" ), | ||
| 189 | + gtk_cell_renderer_text_new(), | ||
| 190 | + render_local, | ||
| 191 | + 0, NULL | ||
| 192 | + ); | ||
| 193 | + | ||
| 194 | + gtk_tree_view_insert_column_with_data_func( | ||
| 195 | + GTK_TREE_VIEW(widget), | ||
| 196 | + -1, | ||
| 197 | + _( "Remote file" ), | ||
| 198 | + gtk_cell_renderer_text_new(), | ||
| 199 | + render_remote, | ||
| 200 | + 0, NULL | ||
| 201 | + ); | ||
| 202 | + | ||
| 203 | + return widget; | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + void v3270_activity_list_append(GtkWidget *widget, GObject *activity) | ||
| 207 | + { | ||
| 208 | + GtkTreeModel * model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | ||
| 209 | + GtkTreeIter iter; | ||
| 210 | + gtk_list_store_append((GtkListStore *) model,&iter); | ||
| 211 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, activity, -1); | ||
| 212 | + } |
src/v3270ft/dialog.c
| @@ -79,20 +79,6 @@ static GtkWidget * create_button(V3270FTDialog *widget, FT_BUTTON id, const gcha | @@ -79,20 +79,6 @@ static GtkWidget * create_button(V3270FTDialog *widget, FT_BUTTON id, const gcha | ||
| 79 | } | 79 | } |
| 80 | */ | 80 | */ |
| 81 | 81 | ||
| 82 | -static void render_local(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) | ||
| 83 | -{ | ||
| 84 | - GObject * activity; | ||
| 85 | - gtk_tree_model_get(tree_model, iter, 0, &activity, -1); | ||
| 86 | - g_object_set(G_OBJECT(cell),"text",v3270_ft_activity_get_local_filename(activity),NULL); | ||
| 87 | -} | ||
| 88 | - | ||
| 89 | -static void render_remote(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) | ||
| 90 | -{ | ||
| 91 | - GObject * activity; | ||
| 92 | - gtk_tree_model_get(tree_model, iter, 0, &activity, -1); | ||
| 93 | - g_object_set(G_OBJECT(cell),"text",v3270_ft_activity_get_remote_filename(activity),NULL); | ||
| 94 | -} | ||
| 95 | - | ||
| 96 | static void V3270FTDialog_init(V3270FTDialog *widget) | 82 | static void V3270FTDialog_init(V3270FTDialog *widget) |
| 97 | { | 83 | { |
| 98 | widget->settings = v3270_ft_settings_new(); | 84 | widget->settings = v3270_ft_settings_new(); |
| @@ -112,35 +98,11 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | @@ -112,35 +98,11 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | ||
| 112 | gtk_widget_set_vexpand(GTK_WIDGET(widget->settings),FALSE); | 98 | gtk_widget_set_vexpand(GTK_WIDGET(widget->settings),FALSE); |
| 113 | gtk_box_pack_start(GTK_BOX(container),widget->settings,FALSE,FALSE,0); | 99 | gtk_box_pack_start(GTK_BOX(container),widget->settings,FALSE,FALSE,0); |
| 114 | 100 | ||
| 115 | - | ||
| 116 | // Create file list view | 101 | // Create file list view |
| 117 | { | 102 | { |
| 118 | - GtkTreeModel * model = GTK_TREE_MODEL(gtk_list_store_new(1,G_TYPE_OBJECT)); | ||
| 119 | - GtkWidget * files = gtk_tree_view_new_with_model(model); | ||
| 120 | - | 103 | + GtkWidget * files = v3270_activity_list_new(); |
| 121 | gtk_widget_set_tooltip_markup(files,_("Files to transfer")); | 104 | gtk_widget_set_tooltip_markup(files,_("Files to transfer")); |
| 122 | 105 | ||
| 123 | - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(files),TRUE); | ||
| 124 | - gtk_tree_view_set_reorderable(GTK_TREE_VIEW(files),TRUE); | ||
| 125 | - | ||
| 126 | - gtk_tree_view_insert_column_with_data_func( | ||
| 127 | - GTK_TREE_VIEW(files), | ||
| 128 | - -1, | ||
| 129 | - _( "Local file" ), | ||
| 130 | - gtk_cell_renderer_text_new(), | ||
| 131 | - render_local, | ||
| 132 | - 0, NULL | ||
| 133 | - ); | ||
| 134 | - | ||
| 135 | - gtk_tree_view_insert_column_with_data_func( | ||
| 136 | - GTK_TREE_VIEW(files), | ||
| 137 | - -1, | ||
| 138 | - _( "Remote file" ), | ||
| 139 | - gtk_cell_renderer_text_new(), | ||
| 140 | - render_remote, | ||
| 141 | - 0, NULL | ||
| 142 | - ); | ||
| 143 | - | ||
| 144 | // Put the view inside a scrolled window. | 106 | // Put the view inside a scrolled window. |
| 145 | GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL); | 107 | GtkWidget * scrolled = gtk_scrolled_window_new(NULL,NULL); |
| 146 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); | 108 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); |
| @@ -153,15 +115,15 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | @@ -153,15 +115,15 @@ static void V3270FTDialog_init(V3270FTDialog *widget) | ||
| 153 | 115 | ||
| 154 | gtk_box_pack_start(GTK_BOX(container),frame,TRUE,TRUE,0); | 116 | gtk_box_pack_start(GTK_BOX(container),frame,TRUE,TRUE,0); |
| 155 | 117 | ||
| 156 | - /* | 118 | +#ifdef DEBUG |
| 157 | GObject * activity = v3270_ft_activity_new(); | 119 | GObject * activity = v3270_ft_activity_new(); |
| 120 | + | ||
| 158 | v3270_ft_activity_set_local_filename(activity,"local---"); | 121 | v3270_ft_activity_set_local_filename(activity,"local---"); |
| 159 | v3270_ft_activity_set_remote_filename(activity,"remote---"); | 122 | v3270_ft_activity_set_remote_filename(activity,"remote---"); |
| 160 | 123 | ||
| 161 | - GtkTreeIter iter; | ||
| 162 | - gtk_list_store_append((GtkListStore *) model,&iter); | ||
| 163 | - gtk_list_store_set((GtkListStore *) model, &iter, 0, activity, -1); | ||
| 164 | - */ | 124 | + v3270_activity_list_append(files,activity); |
| 125 | + v3270_ft_settings_set_activity(widget->settings,activity); | ||
| 126 | +#endif // DEBUG | ||
| 165 | 127 | ||
| 166 | } | 128 | } |
| 167 | 129 |
src/v3270ft/settings.c
| @@ -387,3 +387,11 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP | @@ -387,3 +387,11 @@ static void open_select_file_dialog(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconP | ||
| 387 | return GTK_WIDGET(g_object_new(GTK_TYPE_V3270_FT_SETTINGS, NULL)); | 387 | return GTK_WIDGET(g_object_new(GTK_TYPE_V3270_FT_SETTINGS, NULL)); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | + LIB3270_EXPORT void v3270_ft_settings_set_activity(GtkWidget *widget, GObject *activity) | ||
| 391 | + { | ||
| 392 | + V3270FTSettings * settings = GTK_V3270_FT_SETTINGS(widget); | ||
| 393 | + | ||
| 394 | + gtk_entry_set_text(settings->file.local,v3270_ft_activity_get_local_filename(activity)); | ||
| 395 | + gtk_entry_set_text(settings->file.remote,v3270_ft_activity_get_remote_filename(activity)); | ||
| 396 | + | ||
| 397 | + } |