Revision: 1721
http://geeqie.svn.sourceforge.net/geeqie/?rev=1721&view=rev
Author: nadvornik
Date: 2009-06-02 22:33:53 +0000 (Tue, 02 Jun 2009)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/src/filedata.c
trunk/src/filedata.h
trunk/src/utilops.c
trunk/src/view_file_icon.c
trunk/src/view_file_list.c
Modified: trunk/src/filedata.c
===================================================================
--- trunk/src/filedata.c 2009-06-01 16:37:30 UTC (rev 1720)
+++ trunk/src/filedata.c 2009-06-02 22:33:53 UTC (rev 1721)
@@ -2335,8 +2335,89 @@
return TRUE;
}
+static gboolean file_data_list_contains_whole_group(GList *list, FileData *fd)
+{
+ GList *work;
+ if (fd->parent) fd = fd->parent;
+ if (!g_list_find(list, fd)) return FALSE;
+
+ work = fd->sidecar_files;
+ while (work)
+ {
+ if (!g_list_find(list, work->data)) return FALSE;
+ work = work->next;
+ }
+ return TRUE;
+}
+
+#if 0
+static gboolean file_data_list_dump(GList *list)
+{
+ GList *work, *work2;
+
+ work = list;
+ while (work)
+ {
+ FileData *fd = work->data;
+ printf("%s\n", fd->name);
+ work2 = fd->sidecar_files;
+ while (work2)
+ {
+ FileData *fd = work2->data;
+ printf(" %s\n", fd->name);
+ work2 = work2->next;
+ }
+ work = work->next;
+ }
+ return TRUE;
+}
+#endif
+
+GList *file_data_process_groups(GList *list)
+{
+ GList *out = NULL;
+ GList *work = list;
+
+ /* change partial groups to independent files */
+ while (work)
+ {
+ FileData *fd = work->data;
+ work = work->next;
+
+ if (!file_data_list_contains_whole_group(list, fd))
+ file_data_disable_grouping(fd, TRUE);
+ }
+
+ /* remove sidecars from the list,
+ they can be still acessed via main_fd->sidecar_files */
+ work = list;
+ while (work)
+ {
+ FileData *fd = work->data;
+ work = work->next;
+
+ if (!fd->parent)
+ {
+ out = g_list_prepend(out, fd);
+ }
+ else
+ {
+ file_data_unref(fd);
+ }
+ }
+
+ g_list_free(list);
+ out = g_list_reverse(out);
+
+ return out;
+}
+
+
+
+
+
/*
- * notify other modules about the change described by FileFataChangeInfo
+ * notify other modules about the change described by FileDataChangeInfo
*/
/* might use file_maint_ functions for now, later it should be changed to a
system of callbacks
Modified: trunk/src/filedata.h
===================================================================
--- trunk/src/filedata.h 2009-06-01 16:37:30 UTC (rev 1720)
+++ trunk/src/filedata.h 2009-06-02 22:33:53 UTC (rev 1721)
@@ -126,6 +126,9 @@
void file_data_sc_free_ci(FileData *fd);
void file_data_sc_free_ci_list(GList *fd_list);
+GList *file_data_process_groups(GList *list);
+
+
typedef void (*FileDataNotifyFunc)(FileData *fd, NotifyType type, gpointer
data);
gboolean file_data_register_notify_func(FileDataNotifyFunc func, gpointer
data, NotifyPriority priority);
gboolean file_data_unregister_notify_func(FileDataNotifyFunc func, gpointer
data);
Modified: trunk/src/utilops.c
===================================================================
--- trunk/src/utilops.c 2009-06-01 16:37:30 UTC (rev 1720)
+++ trunk/src/utilops.c 2009-06-02 22:33:53 UTC (rev 1721)
@@ -1700,20 +1700,6 @@
file_util_warning_dialog(title, _("Another operation in progress.\n"),
GTK_STOCK_DIALOG_ERROR, NULL);
}
-static void file_util_disable_grouping_sc_list(GList *list)
-{
- GList *work = list;
-
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
-
- if (fd->parent) file_data_disable_grouping(fd, TRUE);
- }
-
-}
-
static void file_util_details_dialog_close_cb(GtkWidget *widget, gpointer data)
{
gtk_widget_destroy(data);
@@ -1943,7 +1929,7 @@
if (!flist) return;
- file_util_disable_grouping_sc_list(flist);
+ flist = file_data_process_groups(flist);
if (!file_data_sc_add_ci_delete_list(flist))
{
@@ -2030,7 +2016,7 @@
if (!flist) return;
- file_util_disable_grouping_sc_list(flist);
+ flist = file_data_process_groups(flist);
if (!file_data_sc_add_ci_move_list(flist, dest_path))
{
@@ -2071,7 +2057,7 @@
if (!flist) return;
- file_util_disable_grouping_sc_list(flist);
+ flist = file_data_process_groups(flist);
if (!file_data_sc_add_ci_copy_list(flist, dest_path))
{
@@ -2112,7 +2098,7 @@
if (!flist) return;
- file_util_disable_grouping_sc_list(flist);
+ flist = file_data_process_groups(flist);
if (!file_data_sc_add_ci_rename_list(flist, dest_path))
{
@@ -2162,7 +2148,7 @@
if (!flist) return;
- file_util_disable_grouping_sc_list(flist);
+ flist = file_data_process_groups(flist);
if (!file_data_sc_add_ci_unspecified_list(flist, dest_path))
{
Modified: trunk/src/view_file_icon.c
===================================================================
--- trunk/src/view_file_icon.c 2009-06-01 16:37:30 UTC (rev 1720)
+++ trunk/src/view_file_icon.c 2009-06-02 22:33:53 UTC (rev 1721)
@@ -170,7 +170,8 @@
return vf_selection_get_list(vf);
}
- return g_list_append(NULL, file_data_ref(VFICON(vf)->click_id->fd));
+
+ return
g_list_prepend(filelist_copy(VFICON(vf)->click_id->fd->sidecar_files),
file_data_ref(VFICON(vf)->click_id->fd));
}
void vficon_pop_menu_view_cb(GtkWidget *widget, gpointer data)
@@ -907,7 +908,7 @@
GList *vficon_selection_get_list(ViewFile *vf)
{
GList *list = NULL;
- GList *work;
+ GList *work, *work2;
work = VFICON(vf)->selection;
while (work)
@@ -917,6 +918,14 @@
g_assert(fd->magick == 0x12345678);
list = g_list_prepend(list, file_data_ref(fd));
+
+ work2 = fd->sidecar_files;
+ while (work2)
+ {
+ fd = work2->data;
+ list = g_list_prepend(list, file_data_ref(fd));
+ work2 = work2->next;
+ }
work = work->next;
}
Modified: trunk/src/view_file_list.c
===================================================================
--- trunk/src/view_file_list.c 2009-06-01 16:37:30 UTC (rev 1720)
+++ trunk/src/view_file_list.c 2009-06-02 22:33:53 UTC (rev 1721)
@@ -362,6 +362,7 @@
GList *vflist_pop_menu_file_list(ViewFile *vf)
{
+ GList *list;
if (!VFLIST(vf)->click_fd) return NULL;
if (vflist_row_is_selected(vf, VFLIST(vf)->click_fd))
@@ -369,7 +370,37 @@
return vf_selection_get_list(vf);
}
- return g_list_append(NULL, file_data_ref(VFLIST(vf)->click_fd));
+ list = g_list_append(NULL, file_data_ref(VFLIST(vf)->click_fd));
+
+ if (VFLIST(vf)->click_fd->sidecar_files)
+ {
+ /* check if the row is expanded */
+ GtkTreeModel *store;
+ GtkTreeIter iter;
+
+ store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview));
+ if (vflist_find_row(vf, VFLIST(vf)->click_fd, &iter) >= 0)
+ {
+ GtkTreePath *tpath;
+
+ tpath = gtk_tree_model_get_path(store, &iter);
+ if
(!gtk_tree_view_row_expanded(GTK_TREE_VIEW(vf->listview), tpath))
+ {
+ /* unexpanded - add whole group */
+ GList *work =
VFLIST(vf)->click_fd->sidecar_files;
+ while (work)
+ {
+ FileData *sfd = work->data;
+ list = g_list_prepend(list,
file_data_ref(sfd));
+ work = work->next;
+ }
+ }
+ gtk_tree_path_free(tpath);
+ }
+ list = g_list_reverse(list);
+ }
+
+ return list;
}
void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data)
@@ -1307,6 +1338,18 @@
gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
list = g_list_prepend(list, file_data_ref(fd));
+
+ if (!fd->parent &&
!gtk_tree_view_row_expanded(GTK_TREE_VIEW(vf->listview), tpath))
+ {
+ /* unexpanded - add whole group */
+ GList *work2 = fd->sidecar_files;
+ while (work2)
+ {
+ FileData *sfd = work2->data;
+ list = g_list_prepend(list, file_data_ref(sfd));
+ work2 = work2->next;
+ }
+ }
work = work->next;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn