Mercurial > geeqie
changeset 1453:bc3f5c0432f6
gint -> gboolean where applicable. The end (ouf!).
author | zas_ |
---|---|
date | Mon, 16 Mar 2009 20:39:09 +0000 |
parents | 67b40740122e |
children | fbd02e4d709e |
files | src/format_canon.c src/format_canon.h src/format_fuji.c src/format_fuji.h src/format_nikon.c src/format_nikon.h src/format_olympus.c src/format_olympus.h src/format_raw.c src/format_raw.h src/typedefs.h src/view_file.c src/view_file.h src/view_file_icon.c src/view_file_icon.h src/view_file_list.c src/view_file_list.h src/window.c src/window.h |
diffstat | 19 files changed, 195 insertions(+), 185 deletions(-) [+] |
line wrap: on
line diff
--- a/src/format_canon.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_canon.c Mon Mar 16 20:39:09 2009 +0000 @@ -43,8 +43,8 @@ *----------------------------------------------------------------------------- */ -static gint canon_cr2_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo, - guint *image_offset, gint *jpeg_encoding) +static gboolean canon_cr2_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo, + guint *image_offset, gint *jpeg_encoding) { guint tag; guint type; @@ -117,8 +117,8 @@ return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo); } -gint format_canon_raw_cr2(guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_canon_raw_cr2(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { guint jpeg_offset = 0; ExifByteOrder bo; @@ -150,8 +150,8 @@ #define CRW_HEADER_SIZE 26 #define CRW_DIR_ENTRY_SIZE 10 -gint format_canon_raw_crw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_canon_raw_crw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { guint block_offset; guint data_length; @@ -601,8 +601,8 @@ } #endif -gint format_canon_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo) +gboolean format_canon_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo) { ExifItem *item;
--- a/src/format_canon.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_canon.h Mon Mar 16 20:39:09 2009 +0000 @@ -23,11 +23,11 @@ #include "exif-int.h" -gint format_canon_raw_crw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset); +gboolean format_canon_raw_crw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset); -gint format_canon_raw_cr2(guchar *data, const guint len, - guint *image_offset, guint *exif_offset); +gboolean format_canon_raw_cr2(guchar *data, const guint len, + guint *image_offset, guint *exif_offset); #define FORMAT_RAW_CANON { "crw", \ FORMAT_RAW_MATCH_MAGIC, 6, "HEAPCCDR", 8, \ @@ -39,8 +39,8 @@ "Canon cr2", format_canon_raw_cr2 } -gint format_canon_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo); +gboolean format_canon_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo); #define FORMAT_EXIF_CANON { FORMAT_EXIF_MATCH_MAKE, "Canon", 5, "Canon", format_canon_makernote }
--- a/src/format_fuji.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_fuji.c Mon Mar 16 20:39:09 2009 +0000 @@ -39,8 +39,8 @@ */ -gint format_fuji_raw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_fuji_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { guint io; guint eo; @@ -175,8 +175,8 @@ -gint format_fuji_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo) +gboolean format_fuji_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo) { guchar *data; guint ifdstart;
--- a/src/format_fuji.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_fuji.h Mon Mar 16 20:39:09 2009 +0000 @@ -18,8 +18,8 @@ #include "exif-int.h" -gint format_fuji_raw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset); +gboolean format_fuji_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset); #define FORMAT_RAW_FUJI { "raf", \ @@ -28,8 +28,8 @@ "Fuji raw", format_fuji_raw } -gint format_fuji_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo); +gboolean format_fuji_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo); #define FORMAT_EXIF_FUJI { FORMAT_EXIF_MATCH_MAKERNOTE, "FUJIFILM", 8, "Fujifilm", format_fuji_makernote }
--- a/src/format_nikon.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_nikon.c Mon Mar 16 20:39:09 2009 +0000 @@ -131,8 +131,8 @@ return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo); } -gint format_nikon_raw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_nikon_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { guint i_off = 0; guint i_len = 0; @@ -355,8 +355,8 @@ }; -gint format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo) +gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo) { guchar *data; ExifItem *item;
--- a/src/format_nikon.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_nikon.h Mon Mar 16 20:39:09 2009 +0000 @@ -14,8 +14,8 @@ #include "exif-int.h" -gint format_nikon_raw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset); +gboolean format_nikon_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset); #define FORMAT_RAW_NIKON { "nef", \ FORMAT_RAW_MATCH_TIFF_MAKE, 0, "NIKON CORPORATION", 17, \ @@ -35,8 +35,8 @@ FORMAT_RAW_EXIF_TIFF, NULL, \ "Samsung raw", format_nikon_raw } -gint format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo); +gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo); #define FORMAT_EXIF_NIKON { FORMAT_EXIF_MATCH_MAKERNOTE, "Nikon\x00", 6, "Nikon", format_nikon_makernote }, \ { FORMAT_EXIF_MATCH_MAKE, "NIKON", 5, "Nikon", format_nikon_makernote }
--- a/src/format_olympus.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_olympus.c Mon Mar 16 20:39:09 2009 +0000 @@ -105,8 +105,8 @@ return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo); } -gint format_olympus_raw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_olympus_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { guint i_off = 0; guint e_off = 0; @@ -294,8 +294,8 @@ EXIF_TEXT_LIST_END }; -gint format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo) +gboolean format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo) { guchar *data; ExifItem *item;
--- a/src/format_olympus.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_olympus.h Mon Mar 16 20:39:09 2009 +0000 @@ -15,8 +15,8 @@ #include "exif-int.h" -gint format_olympus_raw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset); +gboolean format_olympus_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset); #define FORMAT_RAW_OLYMPUS { "orf", \ @@ -25,8 +25,8 @@ "Olympus raw", format_olympus_raw } -gint format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo); +gboolean format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo); #define FORMAT_EXIF_OLYMPUS { FORMAT_EXIF_MATCH_MAKERNOTE, "OLYMP\x00\x01", 7, \ "Olympus", format_olympus_makernote }, \
--- a/src/format_raw.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_raw.c Mon Mar 16 20:39:09 2009 +0000 @@ -133,9 +133,9 @@ return exif_byte_get_int32(data + offset + count * 12, bo); } -static gint format_tiff_find_tag_data(guchar *data, const guint len, - guint tag, ExifFormatType type, - guint *result_offset, guint *result_count) +static gboolean format_tiff_find_tag_data(guchar *data, const guint len, + guint tag, ExifFormatType type, + guint *result_offset, guint *result_count) { ExifByteOrder bo; guint offset; @@ -182,7 +182,7 @@ static FormatRawEntry *format_raw_find(guchar *data, const guint len) { gint n; - gint tiff; + gboolean tiff; guint make_count = 0; guint make_offset = 0; @@ -230,13 +230,13 @@ return NULL; } -static gint format_raw_parse(FormatRawEntry *entry, - guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +static gboolean format_raw_parse(FormatRawEntry *entry, + guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { guint io = 0; guint eo = 0; - gint found; + gboolean found; if (!entry || !entry->func_parse) return FALSE; @@ -257,8 +257,8 @@ return TRUE; } -gint format_raw_img_exif_offsets(guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_raw_img_exif_offsets(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { FormatRawEntry *entry; @@ -294,15 +294,15 @@ } -gint format_raw_img_exif_offsets_fd(gint fd, const gchar *path, - guchar *header_data, const guint header_len, - guint *image_offset, guint *exif_offset) +gboolean format_raw_img_exif_offsets_fd(gint fd, const gchar *path, + guchar *header_data, const guint header_len, + guint *image_offset, guint *exif_offset) { FormatRawEntry *entry; gpointer map_data = NULL; size_t map_len = 0; struct stat st; - gint success; + gboolean success; if (!header_data || fd < 0) return FALSE; @@ -414,8 +414,8 @@ return FALSE; } -gint format_exif_makernote_parse(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo) +gboolean format_exif_makernote_parse(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo) { FormatExifEntry *entry; @@ -523,8 +523,8 @@ return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo); } -gint format_debug_tiff_raw(guchar *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_debug_tiff_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { ExifByteOrder bo; gint level;
--- a/src/format_raw.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/format_raw.h Mon Mar 16 20:39:09 2009 +0000 @@ -31,17 +31,17 @@ FORMAT_RAW_EXIF_PROPRIETARY } FormatRawExifType; -typedef gint (* FormatRawParseFunc)(guchar *data, const guint len, - guint *image_offset, guint *exif_offset); +typedef gboolean (* FormatRawParseFunc)(guchar *data, const guint len, + guint *image_offset, guint *exif_offset); -typedef gint (* FormatRawExifParseFunc)(guchar *data, const guint len, - ExifData *exif); +typedef gboolean (* FormatRawExifParseFunc)(guchar *data, const guint len, + ExifData *exif); -gint format_raw_img_exif_offsets(guchar *data, const guint len, - guint *image_offset, guint *exif_offset); -gint format_raw_img_exif_offsets_fd(gint fd, const gchar *path, - guchar *header_data, const guint header_len, - guint *image_offset, guint *exif_offset); +gboolean format_raw_img_exif_offsets(guchar *data, const guint len, + guint *image_offset, guint *exif_offset); +gboolean format_raw_img_exif_offsets_fd(gint fd, const gchar *path, + guchar *header_data, const guint header_len, + guint *image_offset, guint *exif_offset); FormatRawExifType format_raw_exif_offset(guchar *data, const guint len, guint *exif_offset, FormatRawExifParseFunc *exif_parse_func); @@ -53,10 +53,10 @@ } FormatExifMatchType; typedef gint (* FormatExifParseFunc)(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo); + guint size, ExifByteOrder bo); -gint format_exif_makernote_parse(ExifData *exif, guchar *tiff, guint offset, - guint size, ExifByteOrder bo); +gboolean format_exif_makernote_parse(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo); #define DEBUG_RAW_TIFF 0
--- a/src/typedefs.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/typedefs.h Mon Mar 16 20:39:09 2009 +0000 @@ -470,7 +470,7 @@ gint ref; gint version; /* increased when any field in this structure is changed */ - gint disable_grouping; + gboolean disable_grouping; gint user_orientation; gint exif_orientation; @@ -605,7 +605,7 @@ GtkWidget *file_view; SortType sort_method; - gint sort_ascend; + gboolean sort_ascend; /* status bar */ @@ -708,7 +708,7 @@ GList *list; SortType sort_method; - gint sort_ascend; + gboolean sort_ascend; /* func list */ void (*func_thumb_status)(ViewFile *vf, gdouble val, const gchar *text, gpointer data); @@ -722,12 +722,12 @@ GtkWidget *popup; /* thumbs updates*/ - gint thumbs_running; + gboolean thumbs_running; ThumbLoader *thumbs_loader; FileData *thumbs_filedata; /* marks */ - gint marks_enabled; + gboolean marks_enabled; gint active_mark; gint clicked_mark; @@ -743,7 +743,7 @@ FileData *click_fd; FileData *select_fd; - gint thumbs_enabled; + gboolean thumbs_enabled; gint select_idle_id; }; @@ -769,7 +769,7 @@ gint focus_row; gint focus_column; - gint show_text; + gboolean show_text; }; struct _SlideShowData @@ -789,7 +789,7 @@ guint slide_count; gint timeout_id; - gint from_selection; + gboolean from_selection; void (*stop_func)(SlideShowData *, gpointer); gpointer stop_data;
--- a/src/view_file.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/view_file.c Mon Mar 16 20:39:09 2009 +0000 @@ -38,7 +38,7 @@ *----------------------------------------------------------------------------- */ -void vf_sort_set(ViewFile *vf, SortType type, gint ascend) +void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend) { switch (vf->type) { @@ -112,7 +112,7 @@ *------------------------------------------------------------------- */ -static gint vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +static gboolean vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { ViewFile *vf = data; gboolean ret = FALSE; @@ -132,7 +132,7 @@ *------------------------------------------------------------------- */ -static gint vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean vf_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewFile *vf = data; gboolean ret = FALSE; @@ -146,7 +146,7 @@ return ret; } -static gint vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean vf_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewFile *vf = data; gboolean ret = FALSE; @@ -167,6 +167,20 @@ *----------------------------------------------------------------------------- */ +gboolean vf_index_is_selected(ViewFile *vf, gint row) +{ + gboolean ret = FALSE; + + switch (vf->type) + { + case FILEVIEW_LIST: ret = vflist_index_is_selected(vf, row); break; + case FILEVIEW_ICON: ret = vficon_index_is_selected(vf, row); break; + } + + return ret; +} + + guint vf_selection_count(ViewFile *vf, gint64 *bytes) { guint count = 0; @@ -485,7 +499,7 @@ GtkWidget *menu; GtkWidget *item; GtkWidget *submenu; - gint active = 0; + gboolean active = FALSE; switch (vf->type) { @@ -601,7 +615,7 @@ return menu; } -gint vf_refresh(ViewFile *vf) +gboolean vf_refresh(ViewFile *vf) { gboolean ret = FALSE; @@ -614,7 +628,7 @@ return ret; } -gint vf_set_fd(ViewFile *vf, FileData *dir_fd) +gboolean vf_set_fd(ViewFile *vf, FileData *dir_fd) { gboolean ret = FALSE; @@ -739,7 +753,7 @@ vf->data_thumb_status = data; } -void vf_thumb_set(ViewFile *vf, gint enable) +void vf_thumb_set(ViewFile *vf, gboolean enable) { switch (vf->type) { @@ -748,7 +762,7 @@ } } -void vf_marks_set(ViewFile *vf, gint enable) +void vf_marks_set(ViewFile *vf, gboolean enable) { if (vf->marks_enabled == enable) return; @@ -795,7 +809,7 @@ *----------------------------------------------------------------------------- */ -static gint vf_refresh_idle_cb(gpointer data) +static gboolean vf_refresh_idle_cb(gpointer data) { ViewFile *vf = data;
--- a/src/view_file.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/view_file.h Mon Mar 16 20:39:09 2009 +0000 @@ -26,13 +26,13 @@ void vf_set_layout(ViewFile *vf, LayoutWindow *layout); -gint vf_set_fd(ViewFile *vf, FileData *fd); -gint vf_refresh(ViewFile *vf); +gboolean vf_set_fd(ViewFile *vf, FileData *fd); +gboolean vf_refresh(ViewFile *vf); void vf_refresh_idle(ViewFile *vf); -void vf_thumb_set(ViewFile *vf, gint enable); -void vf_marks_set(ViewFile *vf, gint enable); -void vf_sort_set(ViewFile *vf, SortType type, gint ascend); +void vf_thumb_set(ViewFile *vf, gboolean enable); +void vf_marks_set(ViewFile *vf, gboolean enable); +void vf_sort_set(ViewFile *vf, SortType type, gboolean ascend); guint vf_marks_get_filter(ViewFile *vf); @@ -58,10 +58,8 @@ void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode); void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode); -void vf_select_marked(ViewFile *vf, gint mark); -void vf_mark_selected(ViewFile *vf, gint mark, gint value); - void vf_refresh_idle_cancel(ViewFile *vf); void vf_notify_cb(FileData *fd, NotifyType type, gpointer data); + #endif /* VIEW_FILE_H */ /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/view_file_icon.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/view_file_icon.c Mon Mar 16 20:39:09 2009 +0000 @@ -139,12 +139,12 @@ return filelist_sort_compare_filedata(ida->fd, idb->fd); } -GList *iconlist_sort(GList *list, SortType method, gint ascend) +GList *iconlist_sort(GList *list, SortType method, gboolean ascend) { return filelist_sort_full(list, method, ascend, (GCompareFunc) iconlist_sort_file_cb); } -GList *iconlist_insert_sort(GList *list, IconData *id, SortType method, gint ascend) +GList *iconlist_insert_sort(GList *list, IconData *id, SortType method, gboolean ascend) { return filelist_insert_sort_full(list, id, method, ascend, (GCompareFunc) iconlist_sort_file_cb); } @@ -152,10 +152,10 @@ static void vficon_toggle_filenames(ViewFile *vf); static void vficon_selection_remove(ViewFile *vf, IconData *id, SelectionType mask, GtkTreeIter *iter); -static void vficon_move_focus(ViewFile *vf, gint row, gint col, gint relative); +static void vficon_move_focus(ViewFile *vf, gint row, gint col, gboolean relative); static void vficon_set_focus(ViewFile *vf, IconData *id); static void vficon_thumb_update(ViewFile *vf); -static void vficon_populate_at_new_size(ViewFile *vf, gint w, gint h, gint force); +static void vficon_populate_at_new_size(ViewFile *vf, gint w, gint h, gboolean force); /* @@ -290,7 +290,7 @@ *------------------------------------------------------------------- */ -static gint vficon_find_position(ViewFile *vf, IconData *id, gint *row, gint *col) +static gboolean vficon_find_position(ViewFile *vf, IconData *id, gint *row, gint *col) { gint n; @@ -304,7 +304,7 @@ return TRUE; } -static gint vficon_find_iter(ViewFile *vf, IconData *id, GtkTreeIter *iter, gint *column) +static gboolean vficon_find_iter(ViewFile *vf, IconData *id, GtkTreeIter *iter, gint *column) { GtkTreeModel *store; gint row, col; @@ -440,7 +440,7 @@ VFICON(vf)->tip_window = NULL; } -static gint tip_schedule_cb(gpointer data) +static gboolean tip_schedule_cb(gpointer data) { ViewFile *vf = data; GtkWidget *window; @@ -796,7 +796,7 @@ vf_send_update(vf); } -static void vficon_select_util(ViewFile *vf, IconData *id, gint select) +static void vficon_select_util(ViewFile *vf, IconData *id, gboolean select) { if (select) { @@ -808,7 +808,7 @@ } } -static void vficon_select_region_util(ViewFile *vf, IconData *start, IconData *end, gint select) +static void vficon_select_region_util(ViewFile *vf, IconData *start, IconData *end, gboolean select) { gint row1, col1; gint row2, col2; @@ -871,7 +871,7 @@ } } -gint vficon_index_is_selected(ViewFile *vf, gint row) +gboolean vficon_index_is_selected(ViewFile *vf, gint row) { IconData *id = g_list_nth_data(vf->list, row); @@ -1071,7 +1071,7 @@ *------------------------------------------------------------------- */ -static void vficon_move_focus(ViewFile *vf, gint row, gint col, gint relative) +static void vficon_move_focus(ViewFile *vf, gint row, gint col, gboolean relative) { gint new_row; gint new_col; @@ -1265,13 +1265,13 @@ popup_menu_position_clamp(menu, x, y, 0); } -gint vficon_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +gboolean vficon_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { ViewFile *vf = data; gint focus_row = 0; gint focus_col = 0; IconData *id; - gint stop_signal; + gboolean stop_signal; stop_signal = TRUE; switch (event->keyval) @@ -1400,7 +1400,7 @@ *------------------------------------------------------------------- */ -static gint vficon_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean vficon_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewFile *vf = data; IconData *id; @@ -1411,7 +1411,7 @@ return FALSE; } -gint vficon_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +gboolean vficon_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewFile *vf = data; GtkTreeIter iter; @@ -1451,12 +1451,12 @@ return FALSE; } -gint vficon_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +gboolean vficon_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewFile *vf = data; GtkTreeIter iter; IconData *id = NULL; - gint was_selected; + gboolean was_selected; tip_schedule(vf); @@ -1472,7 +1472,7 @@ if (!id || VFICON(vf)->click_id != id) return TRUE; - was_selected = (id->selected & SELECTION_SELECTED); + was_selected = !!(id->selected & SELECTION_SELECTED); switch (bevent->button) { @@ -1482,7 +1482,7 @@ if (bevent->state & GDK_CONTROL_MASK) { - gint select; + gboolean select; select = !(id->selected & SELECTION_SELECTED); if ((bevent->state & GDK_SHIFT_MASK) && VFICON(vf)->prev_selection) @@ -1527,7 +1527,7 @@ return TRUE; } -static gint vficon_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data) +static gboolean vficon_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data) { ViewFile *vf = data; @@ -1590,14 +1590,14 @@ return list; } -static void vficon_populate(ViewFile *vf, gint resize, gint keep_position) +static void vficon_populate(ViewFile *vf, gboolean resize, gboolean keep_position) { GtkTreeModel *store; GtkTreePath *tpath; GList *work; IconData *visible_id = NULL; gint r, c; - gint valid; + gboolean valid; GtkTreeIter iter; vficon_verify_selections(vf); @@ -1732,7 +1732,7 @@ vficon_thumb_update(vf); } -static void vficon_populate_at_new_size(ViewFile *vf, gint w, gint h, gint force) +static void vficon_populate_at_new_size(ViewFile *vf, gint w, gint h, gboolean force) { gint new_cols; gint thumb_width; @@ -1850,7 +1850,7 @@ *----------------------------------------------------------------------------- */ -void vficon_sort_set(ViewFile *vf, SortType type, gint ascend) +void vficon_sort_set(ViewFile *vf, SortType type, gboolean ascend) { if (vf->sort_method == type && vf->sort_ascend == ascend) return; @@ -1868,7 +1868,7 @@ *----------------------------------------------------------------------------- */ -static gint vficon_thumb_next(ViewFile *vf); +static gboolean vficon_thumb_next(ViewFile *vf); static gdouble vficon_thumb_progress(ViewFile *vf) { @@ -1947,7 +1947,7 @@ while (vficon_thumb_next(vf)); } -static gint vficon_thumb_next(ViewFile *vf) +static gboolean vficon_thumb_next(ViewFile *vf) { GtkTreePath *tpath; FileData *fd = NULL; @@ -2160,7 +2160,7 @@ *----------------------------------------------------------------------------- */ -static gint vficon_refresh_real(ViewFile *vf, gint keep_position) +static gboolean vficon_refresh_real(ViewFile *vf, gboolean keep_position) { gboolean ret = TRUE; GList *work, *work_fd; @@ -2290,7 +2290,7 @@ return ret; } -gint vficon_refresh(ViewFile *vf) +gboolean vficon_refresh(ViewFile *vf) { return vficon_refresh_real(vf, TRUE); } @@ -2426,9 +2426,9 @@ *----------------------------------------------------------------------------- */ -gint vficon_set_fd(ViewFile *vf, FileData *dir_fd) +gboolean vficon_set_fd(ViewFile *vf, FileData *dir_fd) { - gint ret; + gboolean ret; if (!dir_fd) return FALSE; if (vf->dir_fd == dir_fd) return TRUE;
--- a/src/view_file_icon.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/view_file_icon.h Mon Mar 16 20:39:09 2009 +0000 @@ -13,21 +13,21 @@ #ifndef VIEW_FILE_ICON_H #define VIEW_FILE_ICON_H -gint vficon_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); -gint vficon_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); -gint vficon_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); +gboolean vficon_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); +gboolean vficon_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); +gboolean vficon_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); void vficon_dnd_init(ViewFile *vf); void vficon_destroy_cb(GtkWidget *widget, gpointer data); ViewFile *vficon_new(ViewFile *vf, FileData *dir_fd); -gint vficon_set_fd(ViewFile *vf, FileData *dir_fd); -gint vficon_refresh(ViewFile *vf); +gboolean vficon_set_fd(ViewFile *vf, FileData *dir_fd); +gboolean vficon_refresh(ViewFile *vf); -void vficon_sort_set(ViewFile *vf, SortType type, gint ascend); +void vficon_sort_set(ViewFile *vf, SortType type, gboolean ascend); -void vficon_marks_set(ViewFile *vf, gint enable); +void vficon_marks_set(ViewFile *vf, gboolean enable); GList *vficon_pop_menu_file_list(ViewFile *vf); void vficon_pop_menu_view_cb(GtkWidget *widget, gpointer data); @@ -42,7 +42,7 @@ guint vficon_count(ViewFile *vf, gint64 *bytes); GList *vficon_get_list(ViewFile *vf); -gint vficon_index_is_selected(ViewFile *vf, gint row); +gboolean vficon_index_is_selected(ViewFile *vf, gint row); guint vficon_selection_count(ViewFile *vf, gint64 *bytes); GList *vficon_selection_get_list(ViewFile *vf); GList *vficon_selection_get_list_by_index(ViewFile *vf);
--- a/src/view_file_list.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/view_file_list.c Mon Mar 16 20:39:09 2009 +0000 @@ -62,8 +62,8 @@ -static gint vflist_row_is_selected(ViewFile *vf, FileData *fd); -static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data); +static gboolean vflist_row_is_selected(ViewFile *vf, FileData *fd); +static gboolean vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data); static void vflist_populate_view(ViewFile *vf); @@ -75,7 +75,7 @@ typedef struct { FileData *fd; GtkTreeIter *iter; - gint found; + gboolean found; gint row; } ViewFileFindRowData; @@ -87,7 +87,7 @@ if (fd == find->fd) { *find->iter = *iter; - find->found = 1; + find->found = TRUE; return TRUE; } find->row++; @@ -97,7 +97,7 @@ static gint vflist_find_row(ViewFile *vf, FileData *fd, GtkTreeIter *iter) { GtkTreeModel *store; - ViewFileFindRowData data = {fd, iter, 0, 0}; + ViewFileFindRowData data = {fd, iter, FALSE, 0}; store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)); gtk_tree_model_foreach(store, vflist_find_row_cb, &data); @@ -194,7 +194,7 @@ gtk_tree_store_clear(GTK_TREE_STORE(store)); } -void vflist_color_set(ViewFile *vf, FileData *fd, gint color_set) +void vflist_color_set(ViewFile *vf, FileData *fd, gboolean color_set) { GtkTreeModel *store; GtkTreeIter iter; @@ -459,15 +459,13 @@ *----------------------------------------------------------------------------- */ -static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data) +static gboolean vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data) { ViewFile *vf = data; - gchar *old_path; gchar *new_path; - if (strlen(new) == 0) return FALSE; + if (!new || !new[0]) return FALSE; - old_path = g_build_filename(vf->dir_fd->path, old, NULL); new_path = g_build_filename(vf->dir_fd->path, new, NULL); if (strchr(new, G_DIR_SEPARATOR) != NULL) @@ -478,11 +476,13 @@ } else { + gchar *old_path = g_build_filename(vf->dir_fd->path, old, NULL); FileData *fd = file_data_new_simple(old_path); /* get the fd from cache */ file_util_rename_simple(fd, new_path, vf->listview); file_data_unref(fd); + g_free(old_path); } - g_free(old_path); + g_free(new_path); return FALSE; @@ -505,7 +505,7 @@ popup_menu_position_clamp(menu, x, y, 0); } -gint vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +gboolean vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { ViewFile *vf = data; GtkTreePath *tpath; @@ -534,7 +534,7 @@ return TRUE; } -gint vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +gboolean vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewFile *vf = data; GtkTreePath *tpath; @@ -617,7 +617,7 @@ return FALSE; } -gint vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +gboolean vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewFile *vf = data; GtkTreePath *tpath; @@ -687,6 +687,7 @@ FileData *read_ahead_fd = NULL; gint row; FileData *cur_fd; + if (!sel_fd) return; cur_fd = layout_image_get_fd(vf->layout); @@ -711,7 +712,7 @@ layout_image_set_with_ahead(vf->layout, sel_fd, read_ahead_fd); } -static gint vflist_select_idle_cb(gpointer data) +static gboolean vflist_select_idle_cb(gpointer data) { ViewFile *vf = data; @@ -840,7 +841,7 @@ { GList *work; GtkTreeIter iter; - gint valid; + gboolean valid; gint num_ordered = 0; gint num_prepended = 0; @@ -967,7 +968,7 @@ } } -void vflist_sort_set(ViewFile *vf, SortType type, gint ascend) +void vflist_sort_set(ViewFile *vf, SortType type, gboolean ascend) { gint i; GHashTable *fd_idx_hash = g_hash_table_new(NULL, NULL); @@ -1018,7 +1019,7 @@ *----------------------------------------------------------------------------- */ -static gint vflist_thumb_next(ViewFile *vf); +static gboolean vflist_thumb_next(ViewFile *vf); static void vflist_thumb_progress_count(GList *list, gint *count, gint *done) { @@ -1112,7 +1113,7 @@ while (vflist_thumb_next(vf)); } -static gint vflist_thumb_next(ViewFile *vf) +static gboolean vflist_thumb_next(ViewFile *vf) { GtkTreePath *tpath; FileData *fd = NULL; @@ -1280,7 +1281,7 @@ *----------------------------------------------------------------------------- */ -static gint vflist_row_is_selected(ViewFile *vf, FileData *fd) +static gboolean vflist_row_is_selected(ViewFile *vf, FileData *fd) { GtkTreeModel *store; GtkTreeSelection *selection; @@ -1308,7 +1309,7 @@ return found; } -gint vflist_index_is_selected(ViewFile *vf, gint row) +gboolean vflist_index_is_selected(ViewFile *vf, gint row) { FileData *fd; @@ -1482,7 +1483,7 @@ while (valid) { - gint selected = gtk_tree_selection_iter_is_selected(selection, &iter); + gboolean selected = gtk_tree_selection_iter_is_selected(selection, &iter); if (selected) gtk_tree_selection_unselect_iter(selection, &iter); @@ -1547,7 +1548,7 @@ GtkTreeModel *store; GtkTreeIter iter; GtkTreeSelection *selection; - gint valid; + gboolean valid; gint n = mark - 1; g_assert(mark >= 1 && mark <= FILEDATA_MARKS_SIZE); @@ -1642,7 +1643,7 @@ *----------------------------------------------------------------------------- */ -static void vflist_listview_set_columns(GtkWidget *listview, gint thumb) +static void vflist_listview_set_columns(GtkWidget *listview, gboolean thumb) { GtkTreeViewColumn *column; GtkCellRenderer *cell; @@ -1688,11 +1689,11 @@ static void vflist_populate_view(ViewFile *vf) { GtkTreeStore *store; - gint thumbs; + gboolean thumbs_enabled; GList *selected; store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview))); - thumbs = VFLIST(vf)->thumbs_enabled; + thumbs_enabled = VFLIST(vf)->thumbs_enabled; vflist_thumb_stop(vf); @@ -1703,7 +1704,7 @@ return; } - vflist_listview_set_columns(vf->listview, thumbs); + vflist_listview_set_columns(vf->listview, thumbs_enabled); selected = vflist_selection_get_list(vf); @@ -1721,7 +1722,7 @@ vflist_thumb_update(vf); } -gint vflist_refresh(ViewFile *vf) +gboolean vflist_refresh(ViewFile *vf) { GList *old_list; gboolean ret = TRUE; @@ -1802,7 +1803,7 @@ "cell-background-set", set, NULL); } -static void vflist_listview_add_column(ViewFile *vf, gint n, const gchar *title, gint image, gint right_justify, gint expand) +static void vflist_listview_add_column(ViewFile *vf, gint n, const gchar *title, gboolean image, gboolean right_justify, gboolean expand) { GtkTreeViewColumn *column; GtkCellRenderer *renderer; @@ -1847,7 +1848,7 @@ GtkTreePath *path = gtk_tree_path_new_from_string(path_str); GtkTreeIter iter; FileData *fd; - gboolean mark; + gboolean marked; guint col_idx; store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview))); @@ -1858,17 +1859,17 @@ g_assert(col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST); - gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, col_idx, &mark, -1); - mark = !mark; + gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, col_idx, &marked, -1); + marked = !marked; file_data_unregister_notify_func(vf_notify_cb, vf); /* we don't need the notification */ - file_data_set_mark(fd, col_idx - FILE_COLUMN_MARKS, mark); + file_data_set_mark(fd, col_idx - FILE_COLUMN_MARKS, marked); if (!file_data_filter_marks(fd, vf_marks_get_filter(vf))) /* file no longer matches the filter -> remove it */ { vf_refresh_idle(vf); } file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM); - gtk_tree_store_set(store, &iter, col_idx, mark, -1); + gtk_tree_store_set(store, &iter, col_idx, marked, -1); gtk_tree_path_free(path); } @@ -1902,7 +1903,7 @@ *----------------------------------------------------------------------------- */ -gint vflist_set_fd(ViewFile *vf, FileData *dir_fd) +gboolean vflist_set_fd(ViewFile *vf, FileData *dir_fd) { if (!dir_fd) return FALSE; if (vf->dir_fd == dir_fd) return TRUE; @@ -2000,7 +2001,7 @@ return vf; } -void vflist_thumb_set(ViewFile *vf, gint enable) +void vflist_thumb_set(ViewFile *vf, gboolean enable) { if (VFLIST(vf)->thumbs_enabled == enable) return; @@ -2008,7 +2009,7 @@ if (vf->layout) vf_refresh(vf); } -void vflist_marks_set(ViewFile *vf, gint enable) +void vflist_marks_set(ViewFile *vf, gboolean enable) { GList *columns, *work;
--- a/src/view_file_list.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/view_file_list.h Mon Mar 16 20:39:09 2009 +0000 @@ -16,21 +16,21 @@ #include "filedata.h" -gint vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); -gint vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); -gint vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); +gboolean vflist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); +gboolean vflist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); +gboolean vflist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); void vflist_dnd_init(ViewFile *vf); void vflist_destroy_cb(GtkWidget *widget, gpointer data); ViewFile *vflist_new(ViewFile *vf, FileData *dir_fd); -gint vflist_set_fd(ViewFile *vf, FileData *dir_fd); -gint vflist_refresh(ViewFile *vf); +gboolean vflist_set_fd(ViewFile *vf, FileData *dir_fd); +gboolean vflist_refresh(ViewFile *vf); -void vflist_thumb_set(ViewFile *vf, gint enable); -void vflist_marks_set(ViewFile *vf, gint enable); -void vflist_sort_set(ViewFile *vf, SortType type, gint ascend); +void vflist_thumb_set(ViewFile *vf, gboolean enable); +void vflist_marks_set(ViewFile *vf, gboolean enable); +void vflist_sort_set(ViewFile *vf, SortType type, gboolean ascend); GList *vflist_pop_menu_file_list(ViewFile *vf); void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data); @@ -44,7 +44,7 @@ guint vflist_count(ViewFile *vf, gint64 *bytes); GList *vflist_get_list(ViewFile *vf); -gint vflist_index_is_selected(ViewFile *vf, gint row); +gboolean vflist_index_is_selected(ViewFile *vf, gint row); guint vflist_selection_count(ViewFile *vf, gint64 *bytes); GList *vflist_selection_get_list(ViewFile *vf); GList *vflist_selection_get_list_by_index(ViewFile *vf); @@ -57,10 +57,7 @@ void vflist_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode); void vflist_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode); -void vflist_select_marked(ViewFile *vf, gint mark); -void vflist_mark_selected(ViewFile *vf, gint mark, gint value); - -void vflist_color_set(ViewFile *vf, FileData *fd, gint color_set); +void vflist_color_set(ViewFile *vf, FileData *fd, gboolean color_set); #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/window.c Mon Mar 16 19:11:39 2009 +0000 +++ b/src/window.c Mon Mar 16 20:39:09 2009 +0000 @@ -65,14 +65,14 @@ } } -gint window_maximized(GtkWidget *window) +gboolean window_maximized(GtkWidget *window) { GdkWindowState state; if (!window || !window->window) return FALSE; state = gdk_window_get_state(window->window); - return (state & GDK_WINDOW_STATE_MAXIMIZED); + return !!(state & GDK_WINDOW_STATE_MAXIMIZED); } /*
--- a/src/window.h Mon Mar 16 19:11:39 2009 +0000 +++ b/src/window.h Mon Mar 16 20:39:09 2009 +0000 @@ -16,7 +16,7 @@ GtkWidget *window_new(GtkWindowType type, const gchar *role, const gchar *icon, const gchar *icon_file, const gchar *subtitle); void window_set_icon(GtkWidget *window, const gchar *icon, const gchar *file); -gint window_maximized(GtkWidget *window); +gboolean window_maximized(GtkWidget *window); void help_window_show(const gchar *key);