Also, moves view_file.c into the view_file subdir.
view_dir_list.h \
view_dir_tree.c \
view_dir_tree.h \
view_dir_list.h \
view_dir_tree.c \
view_dir_tree.h \
view_file.h \
window.c \
window.h \
view_file.h \
window.c \
window.h \
%D%/view_file_icon.c \
%D%/view_file_icon.h \
%D%/view_file_list.c \
%D%/view_file_icon.c \
%D%/view_file_icon.h \
%D%/view_file_list.c \
FileData *vf_index_get_data(ViewFile *vf, gint row)
{
FileData *vf_index_get_data(ViewFile *vf, gint row)
{
- FileData *fd = NULL;
-
- switch (vf->type)
- {
- case FILEVIEW_LIST: fd = vflist_index_get_data(vf, row); break;
- case FILEVIEW_ICON: fd = vficon_index_get_data(vf, row); break;
- }
-
- return fd;
+ return g_list_nth_data(vf->list, row);
}
gint vf_index_by_fd(ViewFile *vf, FileData *fd)
{
}
gint vf_index_by_fd(ViewFile *vf, FileData *fd)
{
- case FILEVIEW_LIST: index = vflist_index_by_fd(vf, fd); break;
- case FILEVIEW_ICON: index = vficon_index_by_fd(vf, fd); break;
+ case FILEVIEW_LIST: return vflist_index_by_fd(vf, fd);
+ case FILEVIEW_ICON: return vficon_index_by_fd(vf, fd);
}
guint vf_count(ViewFile *vf, gint64 *bytes)
{
}
guint vf_count(ViewFile *vf, gint64 *bytes)
{
+ if (bytes)
+ {
+ gint64 b = 0;
+ GList *work;
- switch (vf->type)
- {
- case FILEVIEW_LIST: count = vflist_count(vf, bytes); break;
- case FILEVIEW_ICON: count = vficon_count(vf, bytes); break;
- }
+ work = vf->list;
+ while (work)
+ {
+ FileData *fd = work->data;
+ work = work->next;
+
+ b += fd->size;
+ }
+ *bytes = b;
+ }
+
+ return g_list_length(vf->list);
}
GList *vf_get_list(ViewFile *vf)
{
GList *list = NULL;
}
GList *vf_get_list(ViewFile *vf)
{
GList *list = NULL;
+ GList *work;
+ for (work = vf->list; work; work = work->next)
+ {
+ FileData *fd = work->data;
+ list = g_list_prepend(list, file_data_ref(fd));
+ }
- switch (vf->type)
- {
- case FILEVIEW_LIST: list = vflist_get_list(vf); break;
- case FILEVIEW_ICON: list = vficon_get_list(vf); break;
- }
-
- return list;
+ return g_list_reverse(list);
/*
*-------------------------------------------------------------------
* keyboard
/*
*-------------------------------------------------------------------
* keyboard
static gboolean vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
ViewFile *vf = data;
static gboolean vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
ViewFile *vf = data;
- case FILEVIEW_LIST: ret = vflist_press_key_cb(widget, event, data); break;
- case FILEVIEW_ICON: ret = vficon_press_key_cb(widget, event, data); break;
+ case FILEVIEW_LIST: return vflist_press_key_cb(widget, event, data);
+ case FILEVIEW_ICON: return vficon_press_key_cb(widget, event, data);
static gboolean vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
ViewFile *vf = data;
static gboolean vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
ViewFile *vf = data;
- case FILEVIEW_LIST: ret = vflist_press_cb(widget, bevent, data); break;
- case FILEVIEW_ICON: ret = vficon_press_cb(widget, bevent, data); break;
+ case FILEVIEW_LIST: return vflist_press_cb(widget, bevent, data);
+ case FILEVIEW_ICON: return vficon_press_cb(widget, bevent, data);
}
static gboolean vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
ViewFile *vf = data;
}
static gboolean vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
ViewFile *vf = data;
- case FILEVIEW_LIST: ret = vflist_release_cb(widget, bevent, data); break;
- case FILEVIEW_ICON: ret = vficon_release_cb(widget, bevent, data); break;
+ case FILEVIEW_LIST: return vflist_release_cb(widget, bevent, data);
+ case FILEVIEW_ICON: return vficon_release_cb(widget, bevent, data);
gboolean vf_index_is_selected(ViewFile *vf, gint row)
{
gboolean vf_index_is_selected(ViewFile *vf, gint row)
{
- gboolean ret = FALSE;
-
- case FILEVIEW_LIST: ret = vflist_index_is_selected(vf, row); break;
- case FILEVIEW_ICON: ret = vficon_index_is_selected(vf, row); break;
+ case FILEVIEW_LIST: return vflist_index_is_selected(vf, row);
+ case FILEVIEW_ICON: return vficon_index_is_selected(vf, row);
}
guint vf_selection_count(ViewFile *vf, gint64 *bytes)
{
}
guint vf_selection_count(ViewFile *vf, gint64 *bytes)
{
- case FILEVIEW_LIST: count = vflist_selection_count(vf, bytes); break;
- case FILEVIEW_ICON: count = vficon_selection_count(vf, bytes); break;
+ case FILEVIEW_LIST: return vflist_selection_count(vf, bytes);
+ case FILEVIEW_ICON: return vficon_selection_count(vf, bytes);
}
GList *vf_selection_get_list(ViewFile *vf)
{
}
GList *vf_selection_get_list(ViewFile *vf)
{
- case FILEVIEW_LIST: list = vflist_selection_get_list(vf); break;
- case FILEVIEW_ICON: list = vficon_selection_get_list(vf); break;
+ case FILEVIEW_LIST: return vflist_selection_get_list(vf);
+ case FILEVIEW_ICON: return vficon_selection_get_list(vf);
}
GList *vf_selection_get_list_by_index(ViewFile *vf)
{
}
GList *vf_selection_get_list_by_index(ViewFile *vf)
{
- case FILEVIEW_LIST: list = vflist_selection_get_list_by_index(vf); break;
- case FILEVIEW_ICON: list = vficon_selection_get_list_by_index(vf); break;
+ case FILEVIEW_LIST: return vflist_selection_get_list_by_index(vf);
+ case FILEVIEW_ICON: return vficon_selection_get_list_by_index(vf);
}
void vf_select_all(ViewFile *vf)
}
void vf_select_all(ViewFile *vf)
GList *vf_pop_menu_file_list(ViewFile *vf)
{
GList *vf_pop_menu_file_list(ViewFile *vf)
{
- case FILEVIEW_LIST: ret = vflist_pop_menu_file_list(vf); break;
- case FILEVIEW_ICON: ret = vficon_pop_menu_file_list(vf); break;
+ case FILEVIEW_LIST: return vflist_pop_menu_file_list(vf);
+ case FILEVIEW_ICON: return vficon_pop_menu_file_list(vf);
}
GList *vf_selection_get_one(ViewFile *vf, FileData *fd)
{
}
GList *vf_selection_get_one(ViewFile *vf, FileData *fd)
{
- case FILEVIEW_LIST: ret = vflist_selection_get_one(vf, fd); break;
- case FILEVIEW_ICON: ret = vficon_selection_get_one(vf, fd); break;
+ case FILEVIEW_LIST: return vflist_selection_get_one(vf, fd);
+ case FILEVIEW_ICON: return vficon_selection_get_one(vf, fd);
}
static void vf_pop_menu_edit_cb(GtkWidget *widget, gpointer data)
}
static void vf_pop_menu_edit_cb(GtkWidget *widget, gpointer data)
gboolean vf_refresh(ViewFile *vf)
{
gboolean vf_refresh(ViewFile *vf)
{
- gboolean ret = FALSE;
-
- case FILEVIEW_LIST: ret = vflist_refresh(vf); break;
- case FILEVIEW_ICON: ret = vficon_refresh(vf); break;
+ case FILEVIEW_LIST: return vflist_refresh(vf);
+ case FILEVIEW_ICON: return vficon_refresh(vf);
}
gboolean vf_set_fd(ViewFile *vf, FileData *dir_fd)
{
}
gboolean vf_set_fd(ViewFile *vf, FileData *dir_fd)
{
- gboolean ret = FALSE;
-
- case FILEVIEW_LIST: ret = vflist_set_fd(vf, dir_fd); break;
- case FILEVIEW_ICON: ret = vficon_set_fd(vf, dir_fd); break;
+ case FILEVIEW_LIST: return vflist_set_fd(vf, dir_fd);
+ case FILEVIEW_ICON: return vficon_set_fd(vf, dir_fd);
}
static void vf_destroy_cb(GtkWidget *widget, gpointer data)
}
static void vf_destroy_cb(GtkWidget *widget, gpointer data)
static void vf_thumb_reset_all(ViewFile *vf)
{
static void vf_thumb_reset_all(ViewFile *vf)
{
- switch (vf->type)
- {
- case FILEVIEW_LIST: vflist_thumb_reset_all(vf); break;
- case FILEVIEW_ICON: vficon_thumb_reset_all(vf); break;
- }
+ GList *work;
+
+ for (work = vf->list; work; work = work->next)
+ {
+ FileData *fd = work->data;
+ if (fd->thumb_pixbuf)
+ {
+ g_object_unref(fd->thumb_pixbuf);
+ fd->thumb_pixbuf = NULL;
+ }
+ }
}
void vf_thumb_update(ViewFile *vf)
}
void vf_thumb_update(ViewFile *vf)
-void vficon_thumb_reset_all(ViewFile *vf)
-{
- GList *work = vf->list;
-
- while (work)
- {
- FileData *fd = work->data;
- if (fd->thumb_pixbuf)
- {
- g_object_unref(fd->thumb_pixbuf);
- fd->thumb_pixbuf = NULL;
- }
- work = work->next;
- }
-}
-
-
/*
*-----------------------------------------------------------------------------
* row stuff
*-----------------------------------------------------------------------------
*/
/*
*-----------------------------------------------------------------------------
* row stuff
*-----------------------------------------------------------------------------
*/
-FileData *vficon_index_get_data(ViewFile *vf, gint row)
-{
- FileData *fd;
-
- fd = g_list_nth_data(vf->list, row);
- return fd ? fd : NULL;
-}
-
-
gint vficon_index_by_fd(ViewFile *vf, FileData *in_fd)
{
gint p = 0;
gint vficon_index_by_fd(ViewFile *vf, FileData *in_fd)
{
gint p = 0;
-guint vficon_count(ViewFile *vf, gint64 *bytes)
-{
- if (bytes)
- {
- gint64 b = 0;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
-
- b += fd->size;
- }
-
- *bytes = b;
- }
-
- return g_list_length(vf->list);
-}
-
-GList *vficon_get_list(ViewFile *vf)
-{
- GList *list = NULL;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
-
- list = g_list_prepend(list, file_data_ref(fd));
- }
-
- return g_list_reverse(list);
-}
-
/*
*-----------------------------------------------------------------------------
*
/*
*-----------------------------------------------------------------------------
*
-
-void vflist_thumb_reset_all(ViewFile *vf)
-{
- GList *work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- if (fd->thumb_pixbuf)
- {
- g_object_unref(fd->thumb_pixbuf);
- fd->thumb_pixbuf = NULL;
- }
- work = work->next;
- }
-}
-
/*
*-----------------------------------------------------------------------------
* row stuff
*-----------------------------------------------------------------------------
*/
/*
*-----------------------------------------------------------------------------
* row stuff
*-----------------------------------------------------------------------------
*/
-FileData *vflist_index_get_data(ViewFile *vf, gint row)
-{
- return g_list_nth_data(vf->list, row);
-}
-
gint vflist_index_by_fd(ViewFile *vf, FileData *fd)
{
gint p = 0;
gint vflist_index_by_fd(ViewFile *vf, FileData *fd)
{
gint p = 0;
-guint vflist_count(ViewFile *vf, gint64 *bytes)
-{
- if (bytes)
- {
- gint64 b = 0;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
- b += fd->size;
- }
-
- *bytes = b;
- }
-
- return g_list_length(vf->list);
-}
-
-GList *vflist_get_list(ViewFile *vf)
-{
- GList *list = NULL;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
-
- list = g_list_prepend(list, file_data_ref(fd));
- }
-
- return g_list_reverse(list);
-}
-
/*
*-----------------------------------------------------------------------------
* selections
/*
*-----------------------------------------------------------------------------
* selections