Skip to content

Commit

Permalink
Drop ViewFileIcon, use ViewFile and ViewFileInfoIcon instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed May 4, 2008
1 parent 1267a5c commit d3ade2f
Show file tree
Hide file tree
Showing 5 changed files with 652 additions and 791 deletions.
68 changes: 9 additions & 59 deletions src/layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "utilops.h"
#include "view_dir.h"
#include "view_file.h"
#include "view_file_icon.h"
#include "ui_bookmark.h"
#include "ui_fileops.h"
#include "ui_menu.h"
Expand Down Expand Up @@ -727,55 +726,26 @@ static void layout_list_thumb_cb(ViewFile *vf, gdouble val, const gchar *text, g
layout_status_update_progress(lw, val, text);
}

static void layout_icon_status_cb(ViewFileIcon *vfi, gpointer data)
{
LayoutWindow *lw = data;

layout_status_update_info(lw, NULL);
}

static void layout_icon_thumb_cb(ViewFileIcon *vfi, gdouble val, const gchar *text, gpointer data)
static GtkWidget *layout_list_new(LayoutWindow *lw)
{
LayoutWindow *lw = data;
lw->vf = vf_new(lw->file_view_type, NULL);
vf_set_layout(lw->vf, lw);

layout_status_update_progress(lw, val, text);
}
vf_set_status_func(lw->vf, layout_list_status_cb, lw);
vf_set_thumb_status_func(lw->vf, layout_list_thumb_cb, lw);

static GtkWidget *layout_list_new(LayoutWindow *lw)
{
GtkWidget *widget = NULL;
vf_marks_set(lw->vf, lw->marks_enabled);

switch (lw->file_view_type)
{
case FILEVIEW_ICON:
{
lw->vfi = vficon_new(NULL);
vficon_set_layout(lw->vfi, lw);

vficon_set_status_func(lw->vfi, layout_icon_status_cb, lw);
vficon_set_thumb_status_func(lw->vfi, layout_icon_thumb_cb, lw);
/* FIXME vficon_marks_set(lw->vfi, lw->marks_enabled); */

widget = lw->vfi->widget;
}
break;
case FILEVIEW_LIST:
{
lw->vf = vf_new(lw->file_view_type, NULL);
vf_set_layout(lw->vf, lw);

vf_set_status_func(lw->vf, layout_list_status_cb, lw);
vf_set_thumb_status_func(lw->vf, layout_list_thumb_cb, lw);

vf_marks_set(lw->vf, lw->marks_enabled);
vf_thumb_set(lw->vf, lw->thumbs_enabled);

widget = lw->vf->widget;
}
break;
}

return widget;
return lw->vf->widget;
}

static void layout_list_sync_thumb(LayoutWindow *lw)
Expand All @@ -793,7 +763,6 @@ static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle)
if (!lw) return;
#if 0
if (lw->vf) vf_scroll_to_subpart(lw->vf, needle);
if (lw->vfi) vficon_scroll_to_subpart(lw->vfi, needle);
#endif
}

Expand All @@ -802,7 +771,6 @@ GList *layout_list(LayoutWindow *lw)
if (!layout_valid(&lw)) return NULL;

if (lw->vf) return vf_get_list(lw->vf);
if (lw->vfi) return vficon_get_list(lw->vfi);

return NULL;
}
Expand All @@ -812,7 +780,6 @@ gint layout_list_count(LayoutWindow *lw, gint64 *bytes)
if (!layout_valid(&lw)) return 0;

if (lw->vf) return vf_count(lw->vf, bytes);
if (lw->vfi) return vficon_count(lw->vfi, bytes);

return 0;
}
Expand All @@ -822,7 +789,6 @@ const gchar *layout_list_get_path(LayoutWindow *lw, gint index)
if (!layout_valid(&lw)) return NULL;

if (lw->vf) return vf_index_get_path(lw->vf, index);
if (lw->vfi) return vficon_index_get_path(lw->vfi, index);

return NULL;
}
Expand All @@ -832,7 +798,6 @@ FileData *layout_list_get_fd(LayoutWindow *lw, gint index)
if (!layout_valid(&lw)) return NULL;

if (lw->vf) return vf_index_get_data(lw->vf, index);
if (lw->vfi) return vficon_index_get_data(lw->vfi, index);

return NULL;
}
Expand All @@ -842,7 +807,6 @@ gint layout_list_get_index(LayoutWindow *lw, const gchar *path)
if (!layout_valid(&lw)) return -1;

if (lw->vf) return vf_index_by_path(lw->vf, path);
if (lw->vfi) return vficon_index_by_path(lw->vfi, path);

return -1;
}
Expand All @@ -852,15 +816,13 @@ void layout_list_sync_fd(LayoutWindow *lw, FileData *fd)
if (!layout_valid(&lw)) return;

if (lw->vf) vf_select_by_fd(lw->vf, fd);
if (lw->vfi) vficon_select_by_fd(lw->vfi, fd);
}

static void layout_list_sync_sort(LayoutWindow *lw)
{
if (!layout_valid(&lw)) return;

if (lw->vf) vf_sort_set(lw->vf, lw->sort_method, lw->sort_ascend);
if (lw->vfi) vficon_sort_set(lw->vfi, lw->sort_method, lw->sort_ascend);
}

GList *layout_selection_list(LayoutWindow *lw)
Expand All @@ -877,7 +839,6 @@ GList *layout_selection_list(LayoutWindow *lw)
}

if (lw->vf) return vf_selection_get_list(lw->vf);
if (lw->vfi) return vficon_selection_get_list(lw->vfi);

return NULL;
}
Expand All @@ -887,7 +848,6 @@ GList *layout_selection_list_by_index(LayoutWindow *lw)
if (!layout_valid(&lw)) return NULL;

if (lw->vf) return vf_selection_get_list_by_index(lw->vf);
if (lw->vfi) return vficon_selection_get_list_by_index(lw->vfi);

return NULL;
}
Expand All @@ -897,7 +857,6 @@ gint layout_selection_count(LayoutWindow *lw, gint64 *bytes)
if (!layout_valid(&lw)) return 0;

if (lw->vf) return vf_selection_count(lw->vf, bytes);
if (lw->vfi) return vficon_selection_count(lw->vfi, bytes);

return 0;
}
Expand All @@ -907,31 +866,27 @@ void layout_select_all(LayoutWindow *lw)
if (!layout_valid(&lw)) return;

if (lw->vf) vf_select_all(lw->vf);
if (lw->vfi) vficon_select_all(lw->vfi);
}

void layout_select_none(LayoutWindow *lw)
{
if (!layout_valid(&lw)) return;

if (lw->vf) vf_select_none(lw->vf);
if (lw->vfi) vficon_select_none(lw->vfi);
}

void layout_mark_to_selection(LayoutWindow *lw, gint mark, MarkToSelectionMode mode)
{
if (!layout_valid(&lw)) return;

if (lw->vf) vf_mark_to_selection(lw->vf, mark, mode);
if (lw->vfi) vficon_mark_to_selection(lw->vfi, mark, mode);
}

void layout_selection_to_mark(LayoutWindow *lw, gint mark, SelectionToMarkMode mode)
{
if (!layout_valid(&lw)) return;

if (lw->vf) vf_selection_to_mark(lw->vf, mark, mode);
if (lw->vfi) vficon_selection_to_mark(lw->vfi, mark, mode);

layout_status_update_info(lw, NULL); /* osd in fullscreen mode */
}
Expand All @@ -958,7 +913,6 @@ static void layout_sync_path(LayoutWindow *lw)
if (lw->vd) vd_set_path(lw->vd, lw->path);

if (lw->vf) vf_set_path(lw->vf, lw->path);
if (lw->vfi) vficon_set_path(lw->vfi, lw->path);
}

gint layout_set_path(LayoutWindow *lw, const gchar *path)
Expand Down Expand Up @@ -1032,7 +986,6 @@ static void layout_refresh_lists(LayoutWindow *lw)
if (lw->vd) vd_refresh(lw->vd);

if (lw->vf) vf_refresh(lw->vf);
if (lw->vfi) vficon_refresh(lw->vfi);
}

static void layout_refresh_by_time(LayoutWindow *lw)
Expand Down Expand Up @@ -1307,7 +1260,7 @@ static void layout_tools_hide(LayoutWindow *lw, gint hide)
if (!GTK_WIDGET_VISIBLE(lw->tools))
{
gtk_widget_show(lw->tools);
if (lw->vfi) vficon_refresh(lw->vfi);
if (lw->vf) vf_refresh(lw->vf);
}
}

Expand Down Expand Up @@ -1678,7 +1631,7 @@ void layout_style_set(LayoutWindow *lw, gint style, const gchar *order)

lw->file_view = NULL;
lw->vf = NULL;
lw->vfi = NULL;
lw->vf = NULL;

lw->info_box = NULL;
lw->info_progress_bar = NULL;
Expand Down Expand Up @@ -2061,7 +2014,6 @@ static void layout_real_renamed(LayoutWindow *lw, FileData *fd)
if (lw->image) layout_image_maint_renamed(lw, fd);

if (lw->vf) update |= vf_maint_renamed(lw->vf, fd);
if (lw->vfi) update |= vficon_maint_renamed(lw->vfi, fd);

if (update) layout_real_time_update(lw);
}
Expand All @@ -2073,7 +2025,6 @@ static void layout_real_removed(LayoutWindow *lw, FileData *fd, GList *ignore_li
if (lw->image) layout_image_maint_removed(lw, fd);

if (lw->vf) update |= vf_maint_removed(lw->vf, fd, ignore_list);
if (lw->vfi) update |= vficon_maint_removed(lw->vfi, fd, ignore_list);

if (update) layout_real_time_update(lw);
}
Expand All @@ -2085,7 +2036,6 @@ static void layout_real_moved(LayoutWindow *lw, FileData *fd, GList *ignore_list
if (lw->image) layout_image_maint_moved(lw, fd);

if (lw->vf) update |= vf_maint_moved(lw->vf, fd, ignore_list);
if (lw->vfi) update |= vficon_maint_moved(lw->vfi, fd, ignore_list);

if (update) layout_real_time_update(lw);
}
Expand Down
54 changes: 0 additions & 54 deletions src/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ typedef struct _ViewDirInfoList ViewDirInfoList;
typedef struct _ViewDirInfoTree ViewDirInfoTree;

typedef struct _ViewFile ViewFile;
typedef struct _ViewFileIcon ViewFileIcon;
typedef struct _ViewFileInfoList ViewFileInfoList;
typedef struct _ViewFileInfoIcon ViewFileInfoIcon;

Expand Down Expand Up @@ -504,7 +503,6 @@ struct _LayoutWindow
ViewFile *vf;
FileViewType file_view_type;

ViewFileIcon *vfi;
GtkWidget *file_view;

SortType sort_method;
Expand Down Expand Up @@ -669,58 +667,6 @@ struct _ViewFileInfoIcon
gint sync_idle_id;
};

struct _ViewFileIcon
{
GtkWidget *widget;
GtkWidget *listview;

gchar *path;
GList *list;

/* table stuff */

gint columns;
gint rows;

GList *selection;
struct _IconData *prev_selection;

GtkWidget *tip_window;
gint tip_delay_id;
struct _IconData *tip_id;

struct _IconData *click_id;

struct _IconData *focus_id;
gint focus_row;
gint focus_column;

SortType sort_method;
gint sort_ascend;

gint show_text;

gint sync_idle_id;

/* thumbs */

gint thumbs_running;
gint thumbs_count;
ThumbLoader *thumbs_loader;
FileData *thumbs_filedata;

/* func list */
void (*func_thumb_status)(ViewFileIcon *vfi, gdouble val, const gchar *text, gpointer data);
gpointer data_thumb_status;

void (*func_status)(ViewFileIcon *vfi, gpointer data);
gpointer data_status;

LayoutWindow *layout;

GtkWidget *popup;
};

struct _SlideShowData
{
ImageWindow *imd;
Expand Down
Loading

0 comments on commit d3ade2f

Please sign in to comment.