Commit 0bac84b2f8b66ad9e8b82fe6687ce14a97adfccd
1 parent
6125eaeb
Exists in
master
and in
1 other branch
Working on drag & drop for activity list.
Showing
3 changed files
with
21 additions
and
10 deletions
Show diff stats
src/dialogs/settingsdialog.c
@@ -204,7 +204,7 @@ int v3270_ft_settings_dialog_append_activity(GtkWidget *widget, GObject *activit | @@ -204,7 +204,7 @@ int v3270_ft_settings_dialog_append_activity(GtkWidget *widget, GObject *activit | ||
204 | } | 204 | } |
205 | 205 | ||
206 | // Not found, insert it. | 206 | // Not found, insert it. |
207 | - v3270_activity_list_append(dialog->queue.view,activity); | 207 | + v3270_activity_list_append(dialog->queue.view,activity,FALSE); |
208 | 208 | ||
209 | return 0; | 209 | return 0; |
210 | } | 210 | } |
@@ -251,7 +251,7 @@ static void insert_clicked(GtkWidget *button, V3270FTSettingsDialog *widget) | @@ -251,7 +251,7 @@ static void insert_clicked(GtkWidget *button, V3270FTSettingsDialog *widget) | ||
251 | } | 251 | } |
252 | 252 | ||
253 | // Not found, insert it. | 253 | // Not found, insert it. |
254 | - v3270_activity_list_append(widget->queue.view,v3270_ft_settings_create_activity(widget->settings)); | 254 | + v3270_activity_list_append(widget->queue.view,v3270_ft_settings_create_activity(widget->settings),FALSE); |
255 | 255 | ||
256 | } | 256 | } |
257 | 257 | ||
@@ -440,7 +440,7 @@ static void V3270FTSettingsDialog_init(V3270FTSettingsDialog *widget) | @@ -440,7 +440,7 @@ static void V3270FTSettingsDialog_init(V3270FTSettingsDialog *widget) | ||
440 | v3270_ft_activity_set_remote_filename(activity,"remote---"); | 440 | v3270_ft_activity_set_remote_filename(activity,"remote---"); |
441 | v3270_ft_activity_set_options(activity,LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP|LIB3270_FT_OPTION_APPEND|LIB3270_FT_RECORD_FORMAT_VARIABLE); | 441 | v3270_ft_activity_set_options(activity,LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP|LIB3270_FT_OPTION_APPEND|LIB3270_FT_RECORD_FORMAT_VARIABLE); |
442 | 442 | ||
443 | - v3270_activity_list_append(widget->queue.view,activity); | 443 | + v3270_activity_list_append(widget->queue.view,activity,FALSE); |
444 | #endif // DEBUG | 444 | #endif // DEBUG |
445 | */ | 445 | */ |
446 | 446 |
src/filetransfer/activitylist.c
@@ -138,9 +138,9 @@ | @@ -138,9 +138,9 @@ | ||
138 | g_object_set(G_OBJECT(cell),"text",v3270_ft_activity_get_remote_filename(activity),NULL); | 138 | g_object_set(G_OBJECT(cell),"text",v3270_ft_activity_get_remote_filename(activity),NULL); |
139 | } | 139 | } |
140 | 140 | ||
141 | - gboolean v3270_activity_list_append_filename(GtkWidget *widget, const gchar *filename) | 141 | + gboolean v3270_activity_list_append_filename(GtkWidget *widget, const gchar *filename, gboolean select) |
142 | { | 142 | { |
143 | - debug("%s(%s)",__FUNCTION__,filename); | 143 | + debug("%s(%s,%s)",__FUNCTION__,filename,select ? "SELECT" : "NO-SELECT"); |
144 | 144 | ||
145 | GtkTreeModel * model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | 145 | GtkTreeModel * model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
146 | GtkTreeIter iter; | 146 | GtkTreeIter iter; |
@@ -155,6 +155,10 @@ | @@ -155,6 +155,10 @@ | ||
155 | if(activity && !strcmp(filename,v3270_ft_activity_get_local_filename(activity))) | 155 | if(activity && !strcmp(filename,v3270_ft_activity_get_local_filename(activity))) |
156 | { | 156 | { |
157 | debug("%s already in the list",filename); | 157 | debug("%s already in the list",filename); |
158 | + if(select) | ||
159 | + { | ||
160 | + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)),&iter); | ||
161 | + } | ||
158 | return FALSE; | 162 | return FALSE; |
159 | } | 163 | } |
160 | 164 | ||
@@ -164,7 +168,7 @@ | @@ -164,7 +168,7 @@ | ||
164 | } | 168 | } |
165 | 169 | ||
166 | // Append filename | 170 | // Append filename |
167 | - v3270_activity_list_append(widget,v3270_ft_activity_new_from_filename(filename)); | 171 | + v3270_activity_list_append(widget,v3270_ft_activity_new_from_filename(filename),select); |
168 | 172 | ||
169 | return TRUE; | 173 | return TRUE; |
170 | } | 174 | } |
@@ -178,7 +182,7 @@ | @@ -178,7 +182,7 @@ | ||
178 | for(ix = 0; uris[ix]; ix++) | 182 | for(ix = 0; uris[ix]; ix++) |
179 | { | 183 | { |
180 | if(!g_ascii_strncasecmp("file:///",uris[ix],8)) { | 184 | if(!g_ascii_strncasecmp("file:///",uris[ix],8)) { |
181 | - if(v3270_activity_list_append_filename(widget,uris[ix]+7)) | 185 | + if(v3270_activity_list_append_filename(widget,uris[ix]+7,TRUE)) |
182 | rc++; | 186 | rc++; |
183 | } | 187 | } |
184 | } | 188 | } |
@@ -225,6 +229,7 @@ | @@ -225,6 +229,7 @@ | ||
225 | 0, NULL | 229 | 0, NULL |
226 | ); | 230 | ); |
227 | 231 | ||
232 | + gtk_tree_view_set_activate_on_single_click(GTK_TREE_VIEW(widget),TRUE); | ||
228 | v3270_drag_dest_set(GTK_WIDGET(widget), G_CALLBACK(drag_data_received)); | 233 | v3270_drag_dest_set(GTK_WIDGET(widget), G_CALLBACK(drag_data_received)); |
229 | 234 | ||
230 | } | 235 | } |
@@ -234,7 +239,7 @@ | @@ -234,7 +239,7 @@ | ||
234 | return g_object_new(GTK_TYPE_V3270_FT_ACTIVITY_LIST, NULL); | 239 | return g_object_new(GTK_TYPE_V3270_FT_ACTIVITY_LIST, NULL); |
235 | } | 240 | } |
236 | 241 | ||
237 | - void v3270_activity_list_append(GtkWidget *widget, GObject *activity) | 242 | + void v3270_activity_list_append(GtkWidget *widget, GObject *activity, gboolean select) |
238 | { | 243 | { |
239 | GtkTreeModel * model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); | 244 | GtkTreeModel * model = gtk_tree_view_get_model(GTK_TREE_VIEW(widget)); |
240 | GtkTreeIter iter; | 245 | GtkTreeIter iter; |
@@ -242,6 +247,12 @@ | @@ -242,6 +247,12 @@ | ||
242 | gtk_list_store_set((GtkListStore *) model, &iter, 0, activity, -1); | 247 | gtk_list_store_set((GtkListStore *) model, &iter, 0, activity, -1); |
243 | g_object_ref_sink(activity); | 248 | g_object_ref_sink(activity); |
244 | 249 | ||
250 | + if(select) | ||
251 | + { | ||
252 | + debug("%s: Selecting inserted activity",__FUNCTION__); | ||
253 | + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)),&iter); | ||
254 | + } | ||
255 | + | ||
245 | } | 256 | } |
246 | 257 | ||
247 | void v3270_activity_list_remove(GtkWidget *widget, GObject *activity) | 258 | void v3270_activity_list_remove(GtkWidget *widget, GObject *activity) |
@@ -283,7 +294,7 @@ | @@ -283,7 +294,7 @@ | ||
283 | // Create new activity | 294 | // Create new activity |
284 | GObject * activity = v3270_ft_activity_new(); | 295 | GObject * activity = v3270_ft_activity_new(); |
285 | v3270_ft_activity_set_from_context(activity,context); | 296 | v3270_ft_activity_set_from_context(activity,context); |
286 | - v3270_activity_list_append(GTK_WIDGET(widget), activity); | 297 | + v3270_activity_list_append(GTK_WIDGET(widget), activity, FALSE); |
287 | } | 298 | } |
288 | 299 | ||
289 | } | 300 | } |
src/include/internals.h
@@ -74,7 +74,7 @@ | @@ -74,7 +74,7 @@ | ||
74 | typedef struct _V3270FTActivityListClass V3270FTActivityListClass; | 74 | typedef struct _V3270FTActivityListClass V3270FTActivityListClass; |
75 | 75 | ||
76 | G_GNUC_INTERNAL GtkWidget * v3270_activity_list_new(); | 76 | G_GNUC_INTERNAL GtkWidget * v3270_activity_list_new(); |
77 | - G_GNUC_INTERNAL void v3270_activity_list_append(GtkWidget *widget, GObject *activity); | 77 | + G_GNUC_INTERNAL void v3270_activity_list_append(GtkWidget *widget, GObject *activity, gboolean select); |
78 | G_GNUC_INTERNAL void v3270_activity_list_remove(GtkWidget *widget, GObject *activity); | 78 | G_GNUC_INTERNAL void v3270_activity_list_remove(GtkWidget *widget, GObject *activity); |
79 | G_GNUC_INTERNAL void v3270_activity_list_load(GtkWidget *widget); | 79 | G_GNUC_INTERNAL void v3270_activity_list_load(GtkWidget *widget); |
80 | G_GNUC_INTERNAL void v3270_activity_list_save(GtkWidget *widget); | 80 | G_GNUC_INTERNAL void v3270_activity_list_save(GtkWidget *widget); |