# HG changeset patch # User zas_ # Date 1210540314 0 # Node ID fe700864cb5ad31a63bc83e124855ef80f9f22b1 # Parent 6e9413e92be5074e8f847101a0de9ff44b9096f0 Use vf_* functions where possible. diff -r 6e9413e92be5 -r fe700864cb5a src/view_file.c --- a/src/view_file.c Sun May 11 20:38:21 2008 +0000 +++ b/src/view_file.c Sun May 11 21:11:54 2008 +0000 @@ -16,6 +16,16 @@ #include "view_file_list.h" #include "view_file_icon.h" +/* + *----------------------------------------------------------------------------- + * signals + *----------------------------------------------------------------------------- + */ + +void vf_send_update(ViewFile *vf) +{ + if (vf->func_status) vf->func_status(vf, vf->data_status); +} /* *----------------------------------------------------------------------------- diff -r 6e9413e92be5 -r fe700864cb5a src/view_file.h --- a/src/view_file.h Sun May 11 20:38:21 2008 +0000 +++ b/src/view_file.h Sun May 11 21:11:54 2008 +0000 @@ -14,6 +14,8 @@ #define VIEW_FILE_TYPES_COUNT 2 +void vf_send_update(ViewFile *vf); + ViewFile *vf_new(FileViewType type, const gchar *path); void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data); diff -r 6e9413e92be5 -r fe700864cb5a src/view_file_icon.c --- a/src/view_file_icon.c Sun May 11 20:38:21 2008 +0000 +++ b/src/view_file_icon.c Sun May 11 21:11:54 2008 +0000 @@ -32,7 +32,7 @@ #include "ui_fileops.h" #include "ui_menu.h" #include "ui_tree_edit.h" - +#include "view_file.h" #include /* for keyboard values */ @@ -138,6 +138,7 @@ IconData *idb = b; return filelist_sort_compare_filedata(ida->fd, idb->fd); } + GList *iconlist_sort(GList *list, SortType method, gint ascend) { return filelist_sort_full(list, method, ascend, (GCompareFunc) iconlist_sort_file_cb); @@ -169,7 +170,7 @@ if (VFICON_INFO(vf, click_id)->selected & SELECTION_SELECTED) { - return vficon_selection_get_list(vf); + return vf_selection_get_list(vf); } return g_list_append(NULL, file_data_ref(VFICON_INFO(vf, click_id)->fd)); @@ -208,7 +209,7 @@ { GList *list; - list = vficon_selection_get_list(vf); + list = vf_selection_get_list(vf); view_window_new_from_list(list); filelist_free(list); } @@ -271,7 +272,7 @@ } else { - vficon_sort_set(vf, type, vf->sort_ascend); + vf_sort_set(vf, type, vf->sort_ascend); } } @@ -285,7 +286,7 @@ } else { - vficon_sort_set(vf, vf->sort_method, !vf->sort_ascend); + vf_sort_set(vf, vf->sort_method, !vf->sort_ascend); } } @@ -307,7 +308,7 @@ { ViewFile *vf = data; - vficon_refresh(vf); + vf_refresh(vf); } static void vficon_popup_destroy_cb(GtkWidget *widget, gpointer data) @@ -376,11 +377,6 @@ *------------------------------------------------------------------- */ -static void vficon_send_update(ViewFile *vf) -{ - if (vf->func_status) vf->func_status(vf, vf->data_status); -} - static void vficon_send_layout_select(ViewFile *vf, IconData *id) { FileData *read_ahead_fd = NULL; @@ -400,13 +396,13 @@ row = g_list_index(vf->list, id); if (row > vficon_index_by_fd(vf, cur_fd) && - row + 1 < vficon_count(vf, NULL)) + row + 1 < vf_count(vf, NULL)) { - read_ahead_fd = vficon_index_get_data(vf, row + 1); + read_ahead_fd = vf_index_get_data(vf, row + 1); } else if (row > 0) { - read_ahead_fd = vficon_index_get_data(vf, row - 1); + read_ahead_fd = vf_index_get_data(vf, row - 1); } } @@ -655,7 +651,7 @@ if (VFICON_INFO(vf, click_id)->selected & SELECTION_SELECTED) { - list = vficon_selection_get_list(vf); + list = vf_selection_get_list(vf); } else { @@ -700,7 +696,7 @@ if (context->action == GDK_ACTION_MOVE) { - vficon_refresh(vf); + vf_refresh(vf); } tip_unschedule(vf); @@ -807,7 +803,7 @@ vficon_selection_add(vf, id, SELECTION_SELECTED, NULL); } - vficon_send_update(vf); + vf_send_update(vf); } void vficon_select_none(ViewFile *vf) @@ -826,7 +822,7 @@ g_list_free(VFICON_INFO(vf, selection)); VFICON_INFO(vf, selection) = NULL; - vficon_send_update(vf); + vf_send_update(vf); } void vficon_select_invert(ViewFile *vf) @@ -851,7 +847,7 @@ } } - vficon_send_update(vf); + vf_send_update(vf); } static void vficon_select(ViewFile *vf, IconData *id) @@ -863,7 +859,7 @@ VFICON_INFO(vf, selection) = g_list_append(VFICON_INFO(vf, selection), id); vficon_selection_add(vf, id, SELECTION_SELECTED, NULL); - vficon_send_update(vf); + vf_send_update(vf); } static void vficon_unselect(ViewFile *vf, IconData *id) @@ -875,7 +871,7 @@ VFICON_INFO(vf, selection) = g_list_remove(VFICON_INFO(vf, selection), id); vficon_selection_remove(vf, id, SELECTION_SELECTED, NULL); - vficon_send_update(vf); + vf_send_update(vf); } static void vficon_select_util(ViewFile *vf, IconData *id, gint select) @@ -1029,7 +1025,7 @@ if (!(id->selected & SELECTION_SELECTED)) { - vficon_select_none(vf); + vf_select_none(vf); vficon_select(vf, id); } @@ -1093,7 +1089,7 @@ g_assert(mark >= 0 && mark < FILEDATA_MARKS_SIZE); - slist = vficon_selection_get_list(vf); + slist = vf_selection_get_list(vf); work = slist; while (work) { @@ -1372,7 +1368,7 @@ } else { - vficon_select_none(vf); + vf_select_none(vf); vficon_select(vf, id); vficon_send_layout_select(vf, id); } @@ -1424,7 +1420,7 @@ else { VFICON_INFO(vf, click_id) = new_id; - vficon_select_none(vf); + vf_select_none(vf); vficon_select(vf, new_id); vficon_send_layout_select(vf, new_id); } @@ -1544,7 +1540,7 @@ } else { - vficon_select_none(vf); + vf_select_none(vf); if ((bevent->state & GDK_SHIFT_MASK) && VFICON_INFO(vf, prev_selection)) { @@ -1742,7 +1738,7 @@ VFICON_INFO(vf, rows) = row + 1; - vficon_send_update(vf); + vf_send_update(vf); vficon_thumb_update(vf); } @@ -2574,7 +2570,7 @@ { gint n; - n = vficon_count(vf, NULL); + n = vf_count(vf, NULL); if (ignore_list) { new_row = vficon_maint_find_closest(vf, row, n, ignore_list); @@ -2632,7 +2628,7 @@ if (new_row == -1) { /* selection all ignored, use closest */ - new_row = vficon_maint_find_closest(vf, row, vficon_count(vf, NULL), ignore_list); + new_row = vficon_maint_find_closest(vf, row, vf_count(vf, NULL), ignore_list); } } else @@ -2673,7 +2669,7 @@ g_free(id); vficon_sync_idle(vf); - vficon_send_update(vf); + vf_send_update(vf); return TRUE; } diff -r 6e9413e92be5 -r fe700864cb5a src/view_file_list.c --- a/src/view_file_list.c Sun May 11 20:38:21 2008 +0000 +++ b/src/view_file_list.c Sun May 11 21:11:54 2008 +0000 @@ -28,7 +28,7 @@ #include "ui_fileops.h" #include "ui_menu.h" #include "ui_tree_edit.h" -#include "typedefs.h" +#include "view_file.h" #include /* for keyboard values */ @@ -53,16 +53,6 @@ static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data); static void vflist_populate_view(ViewFile *vf); -/* - *----------------------------------------------------------------------------- - * signals - *----------------------------------------------------------------------------- - */ - -static void vflist_send_update(ViewFile *vf) -{ - if (vf->func_status) vf->func_status(vf, vf->data_status); -} /* *----------------------------------------------------------------------------- @@ -217,7 +207,7 @@ if (vflist_row_is_selected(vf, VFLIST_INFO(vf, click_fd))) { - list = vflist_selection_get_list(vf); + list = vf_selection_get_list(vf); } else { @@ -248,7 +238,7 @@ gint items; if (vflist_row_is_selected(vf, VFLIST_INFO(vf, click_fd))) - items = vflist_selection_count(vf, NULL); + items = vf_selection_count(vf, NULL); else items = 1; @@ -264,7 +254,7 @@ if (context->action == GDK_ACTION_MOVE) { - vflist_refresh(vf); + vf_refresh(vf); } } @@ -293,7 +283,7 @@ if (vflist_row_is_selected(vf, VFLIST_INFO(vf, click_fd))) { - return vflist_selection_get_list(vf); + return vf_selection_get_list(vf); } return g_list_append(NULL, file_data_ref(VFLIST_INFO(vf, click_fd))); @@ -330,7 +320,7 @@ { GList *list; - list = vflist_selection_get_list(vf); + list = vf_selection_get_list(vf); view_window_new_from_list(list); filelist_free(list); } @@ -417,7 +407,7 @@ } else { - vflist_sort_set(vf, type, vf->sort_ascend); + vf_sort_set(vf, type, vf->sort_ascend); } } @@ -431,7 +421,7 @@ } else { - vflist_sort_set(vf, vf->sort_method, !vf->sort_ascend); + vf_sort_set(vf, vf->sort_method, !vf->sort_ascend); } } @@ -462,49 +452,49 @@ ViewFile *vf = data; vflist_color_set(vf, VFLIST_INFO(vf, click_fd), FALSE); - vflist_refresh(vf); + vf_refresh(vf); } static void vflist_pop_menu_sel_mark_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; - vflist_mark_to_selection(vf, vf->active_mark, MTS_MODE_SET); + vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_SET); } static void vflist_pop_menu_sel_mark_and_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; - vflist_mark_to_selection(vf, vf->active_mark, MTS_MODE_AND); + vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_AND); } static void vflist_pop_menu_sel_mark_or_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; - vflist_mark_to_selection(vf, vf->active_mark, MTS_MODE_OR); + vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_OR); } static void vflist_pop_menu_sel_mark_minus_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; - vflist_mark_to_selection(vf, vf->active_mark, MTS_MODE_MINUS); + vf_mark_to_selection(vf, vf->active_mark, MTS_MODE_MINUS); } static void vflist_pop_menu_set_mark_sel_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; - vflist_selection_to_mark(vf, vf->active_mark, STM_MODE_SET); + vf_selection_to_mark(vf, vf->active_mark, STM_MODE_SET); } static void vflist_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; - vflist_selection_to_mark(vf, vf->active_mark, STM_MODE_RESET); + vf_selection_to_mark(vf, vf->active_mark, STM_MODE_RESET); } static void vflist_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data) { ViewFile *vf = data; - vflist_selection_to_mark(vf, vf->active_mark, STM_MODE_TOGGLE); + vf_selection_to_mark(vf, vf->active_mark, STM_MODE_TOGGLE); } @@ -647,7 +637,7 @@ } else { - gint row = vflist_index_by_path(vf, old_path); + gint row = vf_index_by_path(vf, old_path); if (row >= 0) { GList *work = g_list_nth(vf->list, row); @@ -874,13 +864,13 @@ if (sel_fd && options->image.enable_read_ahead && row >= 0) { if (row > g_list_index(vf->list, cur_fd) && - row + 1 < vflist_count(vf, NULL)) + row + 1 < vf_count(vf, NULL)) { - read_ahead_fd = vflist_index_get_data(vf, row + 1); + read_ahead_fd = vf_index_get_data(vf, row + 1); } else if (row > 0) { - read_ahead_fd = vflist_index_get_data(vf, row - 1); + read_ahead_fd = vf_index_get_data(vf, row - 1); } } @@ -897,7 +887,7 @@ return FALSE; } - vflist_send_update(vf); + vf_send_update(vf); if (VFLIST_INFO(vf, select_fd)) { @@ -1394,7 +1384,7 @@ { FileData *fd; - fd = vflist_index_get_data(vf, row); + fd = vf_index_get_data(vf, row); return vflist_row_is_selected(vf, fd); } @@ -1727,7 +1717,7 @@ if (!vf->list) { gtk_tree_store_clear(store); - vflist_send_update(vf); + vf_send_update(vf); return; } @@ -1822,7 +1812,7 @@ gtk_tree_row_reference_free(visible_row); } - vflist_send_update(vf); + vf_send_update(vf); vflist_thumb_update(vf); } @@ -2003,7 +1993,7 @@ filelist_free(vf->list); vf->list = NULL; - return vflist_refresh(vf); + return vf_refresh(vf); } void vflist_destroy_cb(GtkWidget *widget, gpointer data) @@ -2073,7 +2063,7 @@ if (VFLIST_INFO(vf, thumbs_enabled) == enable) return; VFLIST_INFO(vf, thumbs_enabled) = enable; - if (vf->layout) vflist_refresh(vf); + if (vf->layout) vf_refresh(vf); } void vflist_marks_set(ViewFile *vf, gint enable) @@ -2098,7 +2088,7 @@ } g_list_free(columns); - //vflist_refresh(vf); + //vf_refresh(vf); } /* @@ -2117,7 +2107,7 @@ work = ignore_list; while (work) { - gint f = vflist_index_by_path(vf, work->data); + gint f = vf_index_by_path(vf, work->data); if (f >= 0) list = g_list_prepend(list, GINT_TO_POINTER(f)); work = work->next; } @@ -2231,7 +2221,7 @@ { gint n; - n = vflist_count(vf, NULL); + n = vf_count(vf, NULL); if (ignore_list) { new_row = vflist_maint_find_closest(vf, row, n, ignore_list); @@ -2248,10 +2238,10 @@ new_row = row - 1; } } - vflist_select_none(vf); + vf_select_none(vf); if (new_row >= 0) { - fd = vflist_index_get_data(vf, new_row); + fd = vf_index_get_data(vf, new_row); if (vflist_find_row(vf, fd, &iter) >= 0) { GtkTreeSelection *selection; @@ -2263,7 +2253,7 @@ } } - fd = vflist_index_get_data(vf, row); + fd = vf_index_get_data(vf, row); if (vflist_find_row(vf, fd, &iter) >= 0) { GtkTreeStore *store; @@ -2280,7 +2270,7 @@ vf->list = g_list_remove(vf->list, fd); file_data_unref(fd); - vflist_send_update(vf); + vf_send_update(vf); return TRUE; }