Revision: 1599
http://geeqie.svn.sourceforge.net/geeqie/?rev=1599&view=rev
Author: nadvornik
Date: 2009-03-31 21:33:54 +0000 (Tue, 31 Mar 2009)
Log Message:
-----------
improved next/prev operation on sidecar files
all operations with list index seem to be broken but IMHO this fix is
sufficient for 1.0. Then it definitely needs a better interface.
Modified Paths:
--------------
trunk/src/layout.c
trunk/src/view_file.c
trunk/src/view_file.h
trunk/src/view_file_icon.c
trunk/src/view_file_icon.h
trunk/src/view_file_list.c
trunk/src/view_file_list.h
Modified: trunk/src/layout.c
===================================================================
--- trunk/src/layout.c 2009-03-31 20:57:31 UTC (rev 1598)
+++ trunk/src/layout.c 2009-03-31 21:33:54 UTC (rev 1599)
@@ -975,7 +975,7 @@
{
if (!layout_valid(&lw) || !fd) return -1;
- if (lw->vf) return vf_index_by_path(lw->vf, fd->path);
+ if (lw->vf) return vf_index_by_fd(lw->vf, fd);
return -1;
}
Modified: trunk/src/view_file.c
===================================================================
--- trunk/src/view_file.c 2009-03-31 20:57:31 UTC (rev 1598)
+++ trunk/src/view_file.c 2009-03-31 21:33:54 UTC (rev 1599)
@@ -66,14 +66,14 @@
return fd;
}
-gint vf_index_by_path(ViewFile *vf, const gchar *path)
+gint vf_index_by_fd(ViewFile *vf, FileData *fd)
{
gint index = -1;
switch (vf->type)
{
- case FILEVIEW_LIST: index = vflist_index_by_path(vf, path); break;
- case FILEVIEW_ICON: index = vficon_index_by_path(vf, path); break;
+ case FILEVIEW_LIST: index = vflist_index_by_fd(vf, fd); break;
+ case FILEVIEW_ICON: index = vficon_index_by_fd(vf, fd); break;
}
return index;
Modified: trunk/src/view_file.h
===================================================================
--- trunk/src/view_file.h 2009-03-31 20:57:31 UTC (rev 1598)
+++ trunk/src/view_file.h 2009-03-31 21:33:54 UTC (rev 1599)
@@ -40,7 +40,6 @@
GtkWidget *vf_pop_menu(ViewFile *vf);
FileData *vf_index_get_data(ViewFile *vf, gint row);
-gint vf_index_by_path(ViewFile *vf, const gchar *path);
gint vf_index_by_fd(ViewFile *vf, FileData *in_fd);
guint vf_count(ViewFile *vf, gint64 *bytes);
GList *vf_get_list(ViewFile *vf);
Modified: trunk/src/view_file_icon.c
===================================================================
--- trunk/src/view_file_icon.c 2009-03-31 20:57:31 UTC (rev 1598)
+++ trunk/src/view_file_icon.c 2009-03-31 21:33:54 UTC (rev 1599)
@@ -2054,26 +2054,7 @@
return id ? id->fd : NULL;
}
-gint vficon_index_by_path(ViewFile *vf, const gchar *path)
-{
- gint p = 0;
- GList *work;
- if (!path) return -1;
-
- work = vf->list;
- while (work)
- {
- IconData *id = work->data;
- FileData *fd = id->fd;
- if (strcmp(path, fd->path) == 0) return p;
- work = work->next;
- p++;
- }
-
- return -1;
-}
-
gint vficon_index_by_fd(ViewFile *vf, FileData *in_fd)
{
gint p = 0;
Modified: trunk/src/view_file_icon.h
===================================================================
--- trunk/src/view_file_icon.h 2009-03-31 20:57:31 UTC (rev 1598)
+++ trunk/src/view_file_icon.h 2009-03-31 21:33:54 UTC (rev 1599)
@@ -37,7 +37,6 @@
void vficon_pop_menu_show_names_cb(GtkWidget *widget, gpointer data);
FileData *vficon_index_get_data(ViewFile *vf, gint row);
-gint vficon_index_by_path(ViewFile *vf, const gchar *path);
gint vficon_index_by_fd(ViewFile *vf, FileData *in_fd);
guint vficon_count(ViewFile *vf, gint64 *bytes);
GList *vficon_get_list(ViewFile *vf);
Modified: trunk/src/view_file_list.c
===================================================================
--- trunk/src/view_file_list.c 2009-03-31 20:57:31 UTC (rev 1598)
+++ trunk/src/view_file_list.c 2009-03-31 21:33:54 UTC (rev 1599)
@@ -1217,19 +1217,29 @@
return g_list_nth_data(vf->list, row);
}
-gint vflist_index_by_path(ViewFile *vf, const gchar *path)
+gint vflist_index_by_fd(ViewFile *vf, FileData *fd)
{
gint p = 0;
- GList *work;
+ GList *work, *work2;
- if (!path) return -1;
-
work = vf->list;
while (work)
{
- FileData *fd = work->data;
- if (strcmp(path, fd->path) == 0) return p;
+ FileData *list_fd = work->data;
+ if (list_fd == fd) return p;
+ work2 = list_fd->sidecar_files;
+ while (work2)
+ {
+ /* FIXME: return the same index also for sidecars
+ it is sufficient for next/prev navigation but it
should be rewritten
+ without using indexes at all
+ */
+ FileData *sidecar_fd = work2->data;
+ if (sidecar_fd == fd) return p;
+ work2 = work2->next;
+ }
+
work = work->next;
p++;
}
Modified: trunk/src/view_file_list.h
===================================================================
--- trunk/src/view_file_list.h 2009-03-31 20:57:31 UTC (rev 1598)
+++ trunk/src/view_file_list.h 2009-03-31 21:33:54 UTC (rev 1599)
@@ -40,7 +40,7 @@
void vflist_pop_menu_thumbs_cb(GtkWidget *widget, gpointer data);
FileData *vflist_index_get_data(ViewFile *vf, gint row);
-gint vflist_index_by_path(ViewFile *vf, const gchar *path);
+gint vflist_index_by_fd(ViewFile *vf, FileData *fd);
guint vflist_count(ViewFile *vf, gint64 *bytes);
GList *vflist_get_list(ViewFile *vf);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn