comparison src/view_file_list.c @ 1619:011e8dbda7f2

changed selection behavior as requested at http://sourceforge.net/tracker/?func=detail&aid=2789933&group_id=222125&atid=1054680 file view - sidecars are added to the selection if they were expicitly selected or if the entry is collapsed icon view - selection always contains sidecars file operations splits partially selected groups - selected files have disabled grouping
author nadvornik
date Tue, 02 Jun 2009 22:33:53 +0000
parents 74a7f9ea32a1
children 890eca727486
comparison
equal deleted inserted replaced
1618:f47b8dc207f5 1619:011e8dbda7f2
360 *----------------------------------------------------------------------------- 360 *-----------------------------------------------------------------------------
361 */ 361 */
362 362
363 GList *vflist_pop_menu_file_list(ViewFile *vf) 363 GList *vflist_pop_menu_file_list(ViewFile *vf)
364 { 364 {
365 GList *list;
365 if (!VFLIST(vf)->click_fd) return NULL; 366 if (!VFLIST(vf)->click_fd) return NULL;
366 367
367 if (vflist_row_is_selected(vf, VFLIST(vf)->click_fd)) 368 if (vflist_row_is_selected(vf, VFLIST(vf)->click_fd))
368 { 369 {
369 return vf_selection_get_list(vf); 370 return vf_selection_get_list(vf);
370 } 371 }
371 372
372 return g_list_append(NULL, file_data_ref(VFLIST(vf)->click_fd)); 373 list = g_list_append(NULL, file_data_ref(VFLIST(vf)->click_fd));
374
375 if (VFLIST(vf)->click_fd->sidecar_files)
376 {
377 /* check if the row is expanded */
378 GtkTreeModel *store;
379 GtkTreeIter iter;
380
381 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview));
382 if (vflist_find_row(vf, VFLIST(vf)->click_fd, &iter) >= 0)
383 {
384 GtkTreePath *tpath;
385
386 tpath = gtk_tree_model_get_path(store, &iter);
387 if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(vf->listview), tpath))
388 {
389 /* unexpanded - add whole group */
390 GList *work = VFLIST(vf)->click_fd->sidecar_files;
391 while (work)
392 {
393 FileData *sfd = work->data;
394 list = g_list_prepend(list, file_data_ref(sfd));
395 work = work->next;
396 }
397 }
398 gtk_tree_path_free(tpath);
399 }
400 list = g_list_reverse(list);
401 }
402
403 return list;
373 } 404 }
374 405
375 void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data) 406 void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data)
376 { 407 {
377 ViewFile *vf = data; 408 ViewFile *vf = data;
1305 1336
1306 gtk_tree_model_get_iter(store, &iter, tpath); 1337 gtk_tree_model_get_iter(store, &iter, tpath);
1307 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1); 1338 gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
1308 1339
1309 list = g_list_prepend(list, file_data_ref(fd)); 1340 list = g_list_prepend(list, file_data_ref(fd));
1341
1342 if (!fd->parent && !gtk_tree_view_row_expanded(GTK_TREE_VIEW(vf->listview), tpath))
1343 {
1344 /* unexpanded - add whole group */
1345 GList *work2 = fd->sidecar_files;
1346 while (work2)
1347 {
1348 FileData *sfd = work2->data;
1349 list = g_list_prepend(list, file_data_ref(sfd));
1350 work2 = work2->next;
1351 }
1352 }
1310 1353
1311 work = work->next; 1354 work = work->next;
1312 } 1355 }
1313 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL); 1356 g_list_foreach(slist, (GFunc)gtk_tree_path_free, NULL);
1314 g_list_free(slist); 1357 g_list_free(slist);