From 445675df9548d5b7b765a07c7bfe96faa3e4ab6a Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 12 Mar 2009 21:06:37 +0000 Subject: [PATCH] Use gboolean where applicable, for the sake of consistency. --- src/cache-loader.h | 2 +- src/cache.c | 34 +++++++++++----------- src/cache.h | 14 ++++----- src/cache_maint.c | 24 +++++++-------- src/cache_maint.h | 2 +- src/collect-dlg.c | 4 +-- src/collect-io.c | 39 ++++++++++++------------- src/collect-io.h | 8 ++--- src/collect-table.c | 71 ++++++++++++++++++++++----------------------- src/collect.c | 22 +++++++------- src/collect.h | 14 ++++----- src/color-man.c | 17 ++++++----- src/dnd.c | 4 +-- src/dupe.c | 43 +++++++++++++-------------- src/dupe.h | 10 +++---- src/similar.c | 10 +++---- src/similar.h | 6 ++-- 17 files changed, 160 insertions(+), 164 deletions(-) diff --git a/src/cache-loader.h b/src/cache-loader.h index 59571881..6034fbfa 100644 --- a/src/cache-loader.h +++ b/src/cache-loader.h @@ -42,7 +42,7 @@ struct _CacheLoader { CacheLoaderDoneFunc done_func; gpointer done_data; - gint error; + gboolean error; ImageLoader *il; gint idle_id; diff --git a/src/cache.c b/src/cache.c index 283242e9..518a5c41 100644 --- a/src/cache.c +++ b/src/cache.c @@ -74,7 +74,7 @@ void cache_sim_data_free(CacheData *cd) *------------------------------------------------------------------- */ -static gint cache_sim_write_dimensions(SecureSaveInfo *ssi, CacheData *cd) +static gboolean cache_sim_write_dimensions(SecureSaveInfo *ssi, CacheData *cd) { if (!cd || !cd->dimensions) return FALSE; @@ -83,7 +83,7 @@ static gint cache_sim_write_dimensions(SecureSaveInfo *ssi, CacheData *cd) return TRUE; } -static gint cache_sim_write_date(SecureSaveInfo *ssi, CacheData *cd) +static gboolean cache_sim_write_date(SecureSaveInfo *ssi, CacheData *cd) { if (!cd || !cd->have_date) return FALSE; @@ -92,7 +92,7 @@ static gint cache_sim_write_date(SecureSaveInfo *ssi, CacheData *cd) return TRUE; } -static gint cache_sim_write_checksum(SecureSaveInfo *ssi, CacheData *cd) +static gboolean cache_sim_write_checksum(SecureSaveInfo *ssi, CacheData *cd) { if (!cd || !cd->have_checksum) return FALSE; @@ -101,7 +101,7 @@ static gint cache_sim_write_checksum(SecureSaveInfo *ssi, CacheData *cd) return TRUE; } -static gint cache_sim_write_md5sum(SecureSaveInfo *ssi, CacheData *cd) +static gboolean cache_sim_write_md5sum(SecureSaveInfo *ssi, CacheData *cd) { gchar *text; @@ -114,7 +114,7 @@ static gint cache_sim_write_md5sum(SecureSaveInfo *ssi, CacheData *cd) return TRUE; } -static gint cache_sim_write_similarity(SecureSaveInfo *ssi, CacheData *cd) +static gboolean cache_sim_write_similarity(SecureSaveInfo *ssi, CacheData *cd) { guint x, y; guint8 buf[3 * 32]; @@ -145,7 +145,7 @@ static gint cache_sim_write_similarity(SecureSaveInfo *ssi, CacheData *cd) return TRUE; } -gint cache_sim_data_save(CacheData *cd) +gboolean cache_sim_data_save(CacheData *cd) { SecureSaveInfo *ssi; gchar *pathl; @@ -185,7 +185,7 @@ gint cache_sim_data_save(CacheData *cd) *------------------------------------------------------------------- */ -static gint cache_sim_read_skipline(FILE *f, gint s) +static gboolean cache_sim_read_skipline(FILE *f, gint s) { if (!f) return FALSE; @@ -202,7 +202,7 @@ static gint cache_sim_read_skipline(FILE *f, gint s) return FALSE; } -static gint cache_sim_read_comment(FILE *f, gchar *buf, gint s, CacheData *cd) +static gboolean cache_sim_read_comment(FILE *f, gchar *buf, gint s, CacheData *cd) { if (!f || !buf || !cd) return FALSE; @@ -211,7 +211,7 @@ static gint cache_sim_read_comment(FILE *f, gchar *buf, gint s, CacheData *cd) return cache_sim_read_skipline(f, s - 1); } -static gint cache_sim_read_dimensions(FILE *f, gchar *buf, gint s, CacheData *cd) +static gboolean cache_sim_read_dimensions(FILE *f, gchar *buf, gint s, CacheData *cd) { if (!f || !buf || !cd) return FALSE; @@ -254,7 +254,7 @@ static gint cache_sim_read_dimensions(FILE *f, gchar *buf, gint s, CacheData *cd return FALSE; } -static gint cache_sim_read_date(FILE *f, gchar *buf, gint s, CacheData *cd) +static gboolean cache_sim_read_date(FILE *f, gchar *buf, gint s, CacheData *cd) { if (!f || !buf || !cd) return FALSE; @@ -294,7 +294,7 @@ static gint cache_sim_read_date(FILE *f, gchar *buf, gint s, CacheData *cd) return FALSE; } -static gint cache_sim_read_checksum(FILE *f, gchar *buf, gint s, CacheData *cd) +static gboolean cache_sim_read_checksum(FILE *f, gchar *buf, gint s, CacheData *cd) { if (!f || !buf || !cd) return FALSE; @@ -334,7 +334,7 @@ static gint cache_sim_read_checksum(FILE *f, gchar *buf, gint s, CacheData *cd) return FALSE; } -static gint cache_sim_read_md5sum(FILE *f, gchar *buf, gint s, CacheData *cd) +static gboolean cache_sim_read_md5sum(FILE *f, gchar *buf, gint s, CacheData *cd) { if (!f || !buf || !cd) return FALSE; @@ -371,7 +371,7 @@ static gint cache_sim_read_md5sum(FILE *f, gchar *buf, gint s, CacheData *cd) return FALSE; } -static gint cache_sim_read_similarity(FILE *f, gchar *buf, gint s, CacheData *cd) +static gboolean cache_sim_read_similarity(FILE *f, gchar *buf, gint s, CacheData *cd) { if (!f || !buf || !cd) return FALSE; @@ -570,7 +570,7 @@ void cache_sim_data_set_similarity(CacheData *cd, ImageSimilarityData *sd) cd->similarity = TRUE; } -gint cache_sim_data_filled(ImageSimilarityData *sd) +gboolean cache_sim_data_filled(ImageSimilarityData *sd) { if (!sd) return FALSE; return sd->filled; @@ -678,7 +678,7 @@ gchar *cache_find_location(CacheType type, const gchar *source) const gchar *cache_rc; const gchar *cache_local; const gchar *cache_ext; - gint prefer_local; + gboolean prefer_local; if (!source) return NULL; @@ -726,13 +726,13 @@ gchar *cache_find_location(CacheType type, const gchar *source) return path; } -gint cache_time_valid(const gchar *cache, const gchar *path) +gboolean cache_time_valid(const gchar *cache, const gchar *path) { struct stat cache_st; struct stat path_st; gchar *cachel; gchar *pathl; - gint ret = FALSE; + gboolean ret = FALSE; if (!cache || !path) return FALSE; diff --git a/src/cache.h b/src/cache.h index 73c8fba9..61f5d3fd 100644 --- a/src/cache.h +++ b/src/cache.h @@ -48,20 +48,20 @@ struct _CacheData guchar md5sum[16]; ImageSimilarityData *sim; - gint dimensions; - gint have_date; - gint have_checksum; - gint have_md5sum; - gint similarity; + gboolean dimensions; + gboolean have_date; + gboolean have_checksum; + gboolean have_md5sum; + gboolean similarity; }; -gint cache_time_valid(const gchar *cache, const gchar *path); +gboolean cache_time_valid(const gchar *cache, const gchar *path); CacheData *cache_sim_data_new(void); void cache_sim_data_free(CacheData *cd); -gint cache_sim_data_save(CacheData *cd); +gboolean cache_sim_data_save(CacheData *cd); CacheData *cache_sim_data_load(const gchar *path); void cache_sim_data_set_dimensions(CacheData *cd, gint w, gint h); diff --git a/src/cache_maint.c b/src/cache_maint.c index eb43888b..7e5bb909 100644 --- a/src/cache_maint.c +++ b/src/cache_maint.c @@ -36,8 +36,8 @@ struct _CMData GtkWidget *spinner; GtkWidget *button_stop; GtkWidget *button_close; - gint clear; - gint metadata; + gboolean clear; + gboolean metadata; }; #define PURGE_DIALOG_WIDTH 400 @@ -83,7 +83,7 @@ static gchar *extension_find_dot(gchar *path) return dot; } -static gint isempty(const gchar *path) +static gboolean isempty(const gchar *path) { DIR *dp; struct dirent *dir; @@ -133,7 +133,7 @@ static void cache_maintain_home_stop(CMData *cm) gtk_widget_set_sensitive(cm->button_close, TRUE); } -static gint cache_maintain_home_cb(gpointer data) +static gboolean cache_maintain_home_cb(gpointer data) { CMData *cm = data; GList *dlist = NULL; @@ -269,7 +269,7 @@ static void cache_maintain_home_stop_cb(GenericDialog *gd, gpointer data) } /* sorry for complexity (cm->done_list), but need it to remove empty dirs */ -void cache_maintain_home(gint metadata, gint clear, GtkWidget *parent) +void cache_maintain_home(gboolean metadata, gboolean clear, GtkWidget *parent) { CMData *cm; GList *dlist; @@ -671,7 +671,7 @@ struct _CleanData GList *list_dir; gint days; - gint clear; + gboolean clear; GtkWidget *button_close; GtkWidget *button_stop; @@ -685,8 +685,8 @@ struct _CleanData gint count_total; gint count_done; - gint local; - gint recurse; + gboolean local; + gboolean recurse; gint idle_id; }; @@ -755,7 +755,7 @@ static void cache_manager_render_folder(CleanData *cd, FileData *dir_fd) cd->list_dir = g_list_concat(list_d, cd->list_dir); } -static gint cache_manager_render_file(CleanData *cd); +static gboolean cache_manager_render_file(CleanData *cd); static void cache_manager_render_thumb_done_cb(ThumbLoader *tl, gpointer data) { @@ -767,7 +767,7 @@ static void cache_manager_render_thumb_done_cb(ThumbLoader *tl, gpointer data) while (cache_manager_render_file(cd)); } -static gint cache_manager_render_file(CleanData *cd) +static gboolean cache_manager_render_file(CleanData *cd) { if (cd->list) { @@ -987,7 +987,7 @@ static gint cache_manager_standard_clean_clear_cb(gpointer data) return FALSE; } -static void cache_manager_standard_clean_valid_cb(const gchar *path, gint valid, gpointer data) +static void cache_manager_standard_clean_valid_cb(const gchar *path, gboolean valid, gpointer data) { CleanData *cd = data; @@ -1075,7 +1075,7 @@ static void cache_manager_standard_clean_start_cb(GenericDialog *gd, gpointer da } } -static void cache_manager_standard_process(GtkWidget *widget, gint clear) +static void cache_manager_standard_process(GtkWidget *widget, gboolean clear) { CleanData *cd; const gchar *stock_id; diff --git a/src/cache_maint.h b/src/cache_maint.h index dbae389d..c2a8f289 100644 --- a/src/cache_maint.h +++ b/src/cache_maint.h @@ -15,7 +15,7 @@ #define CACHE_MAINT_H -void cache_maintain_home(gint metadata, gint clear, GtkWidget *parent); +void cache_maintain_home(gboolean metadata, gboolean clear, GtkWidget *parent); #if 0 gint cache_maintain_home_dir(const gchar *dir, gint recursive, gint clear); diff --git a/src/collect-dlg.c b/src/collect-dlg.c index ae4be12a..91d6f2fa 100644 --- a/src/collect-dlg.c +++ b/src/collect-dlg.c @@ -30,7 +30,7 @@ enum { }; -static gint collection_save_confirmed(FileDialog *fd, gint overwrite, CollectionData *cd); +static gboolean collection_save_confirmed(FileDialog *fd, gboolean overwrite, CollectionData *cd); static void collection_confirm_ok_cb(GenericDialog *gd, gpointer data) @@ -50,7 +50,7 @@ static void collection_confirm_cancel_cb(GenericDialog *gd, gpointer data) /* this is a no-op, so the cancel button is added */ } -static gint collection_save_confirmed(FileDialog *fd, gint overwrite, CollectionData *cd) +static gboolean collection_save_confirmed(FileDialog *fd, gboolean overwrite, CollectionData *cd) { gchar *buf; diff --git a/src/collect-io.c b/src/collect-io.c index 4db0968c..c5ecabe3 100644 --- a/src/collect-io.c +++ b/src/collect-io.c @@ -38,7 +38,7 @@ static void collect_manager_entry_reset(CollectManagerEntry *entry); static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr); -static gint scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h) +static gboolean scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h) { gint nx, ny, nw, nh; @@ -52,17 +52,17 @@ static gint scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h) return TRUE; } -static gint collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) +static gboolean collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) { gchar s_buf[GQ_COLLECTION_READ_BUFSIZE]; FILE *f; gchar *pathl; - gint limit_failures = TRUE; - gint success = TRUE; - gint has_official_header = FALSE; - gint has_geometry_header = FALSE; - gint has_gqview_header = FALSE; - gint need_header = TRUE; + gboolean limit_failures = TRUE; + gboolean success = TRUE; + gboolean has_official_header = FALSE; + gboolean has_geometry_header = FALSE; + gboolean has_gqview_header = FALSE; + gboolean need_header = TRUE; guint total = 0; guint fail = 0; gboolean changed = FALSE; @@ -210,7 +210,7 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, Colle return success; } -gint collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) +gboolean collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) { if (collection_load_private(cd, path, flags | COLLECTION_LOAD_FLUSH)) { @@ -307,7 +307,7 @@ void collection_load_thumb_idle(CollectionData *cd) if (!cd->thumb_loader) collection_load_thumb_step(cd); } -gint collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) +gboolean collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) { if (!collection_load(cd, path, flags)) return FALSE; @@ -324,7 +324,7 @@ void collection_load_stop(CollectionData *cd) cd->thumb_loader = NULL; } -static gint collection_save_private(CollectionData *cd, const gchar *path) +static gboolean collection_save_private(CollectionData *cd, const gchar *path) { SecureSaveInfo *ssi; GList *work; @@ -391,7 +391,7 @@ static gint collection_save_private(CollectionData *cd, const gchar *path) return TRUE; } -gint collection_save(CollectionData *cd, const gchar *path) +gboolean collection_save(CollectionData *cd, const gchar *path) { if (collection_save_private(cd, path)) { @@ -402,7 +402,7 @@ gint collection_save(CollectionData *cd, const gchar *path) return FALSE; } -gint collection_load_only_geometry(CollectionData *cd, const gchar *path) +gboolean collection_load_only_geometry(CollectionData *cd, const gchar *path) { return collection_load(cd, path, COLLECTION_LOAD_GEOMETRY); } @@ -633,7 +633,7 @@ static void collect_manager_entry_add_action(CollectManagerEntry *entry, Collect collect_manager_action_ref(action); } -static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr) +static gboolean collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr) { gchar *path = *path_ptr; CollectManagerAction *action; @@ -781,10 +781,10 @@ static void collect_manager_process_actions(gint max) } } -static gint collect_manager_process_entry(CollectManagerEntry *entry) +static gboolean collect_manager_process_entry(CollectManagerEntry *entry) { CollectionData *cd; - gint success; + gboolean success; if (entry->empty) return FALSE; @@ -796,7 +796,7 @@ static gint collect_manager_process_entry(CollectManagerEntry *entry) return TRUE; } -static gint collect_manager_process_entry_list(void) +static gboolean collect_manager_process_entry_list(void) { GList *work; @@ -815,7 +815,7 @@ static gint collect_manager_process_entry_list(void) -static gint collect_manager_process_cb(gpointer data) +static gboolean collect_manager_process_cb(gpointer data) { if (collection_manager_action_list) collect_manager_refresh(); collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE); @@ -827,7 +827,7 @@ static gint collect_manager_process_cb(gpointer data) return FALSE; } -static gint collect_manager_timer_cb(gpointer data) +static gboolean collect_manager_timer_cb(gpointer data) { DEBUG_1("collection manager timer expired"); @@ -934,7 +934,6 @@ void collect_manager_flush(void) void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer data) { - if (type != NOTIFY_TYPE_CHANGE || !fd->change) return; switch (fd->change->type) diff --git a/src/collect-io.h b/src/collect-io.h index 2f1c5029..ee42633a 100644 --- a/src/collect-io.h +++ b/src/collect-io.h @@ -21,16 +21,16 @@ typedef enum { COLLECTION_LOAD_GEOMETRY= 1 << 2, } CollectionLoadFlags; -gint collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags); +gboolean collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags); -gint collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags); +gboolean collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags); void collection_load_stop(CollectionData *cd); void collection_load_thumb_idle(CollectionData *cd); -gint collection_save(CollectionData *cd, const gchar *path); +gboolean collection_save(CollectionData *cd, const gchar *path); -gint collection_load_only_geometry(CollectionData *cd, const gchar *path); +gboolean collection_load_only_geometry(CollectionData *cd, const gchar *path); /* these are used to update collections contained in user's collection diff --git a/src/collect-table.c b/src/collect-table.c index ecca8f9a..8471970b 100644 --- a/src/collect-table.c +++ b/src/collect-table.c @@ -65,7 +65,7 @@ typedef enum { #define INFO_SELECTED(x) (x->flag_mask & SELECTION_SELECTED) -static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gint force); +static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gboolean force); /* @@ -74,7 +74,7 @@ static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint *------------------------------------------------------------------- */ -static gint collection_table_find_position(CollectTable *ct, CollectInfo *info, gint *row, gint *col) +static gboolean collection_table_find_position(CollectTable *ct, CollectInfo *info, gint *row, gint *col) { gint n; @@ -88,7 +88,7 @@ static gint collection_table_find_position(CollectTable *ct, CollectInfo *info, return TRUE; } -static gint collection_table_find_iter(CollectTable *ct, CollectInfo *info, GtkTreeIter *iter, gint *column) +static gboolean collection_table_find_iter(CollectTable *ct, CollectInfo *info, GtkTreeIter *iter, gint *column) { GtkTreeModel *store; gint row, col; @@ -227,7 +227,7 @@ static void collection_table_update_status(CollectTable *ct) g_free(buf); } -static void collection_table_update_extras(CollectTable *ct, gint loading, gdouble value) +static void collection_table_update_extras(CollectTable *ct, gboolean loading, gdouble value) { gchar *text; @@ -422,7 +422,7 @@ static void collection_table_unselect(CollectTable *ct, CollectInfo *info) collection_table_update_status(ct); } -static void collection_table_select_util(CollectTable *ct, CollectInfo *info, gint select) +static void collection_table_select_util(CollectTable *ct, CollectInfo *info, gboolean select) { if (select) { @@ -434,7 +434,7 @@ static void collection_table_select_util(CollectTable *ct, CollectInfo *info, gi } } -static void collection_table_select_region_util(CollectTable *ct, CollectInfo *start, CollectInfo *end, gint select) +static void collection_table_select_region_util(CollectTable *ct, CollectInfo *start, CollectInfo *end, gboolean select) { gint row1, col1; gint row2, col2; @@ -548,7 +548,7 @@ static void tip_hide(CollectTable *ct) ct->tip_window = NULL; } -static gint tip_schedule_cb(gpointer data) +static gboolean tip_schedule_cb(gpointer data) { CollectTable *ct = data; @@ -844,7 +844,7 @@ static void collection_table_popup_destroy_cb(GtkWidget *widget, gpointer data) ct->editmenu_fd_list = NULL; } -static GtkWidget *collection_table_popup_menu(CollectTable *ct, gint over_icon) +static GtkWidget *collection_table_popup_menu(CollectTable *ct, gboolean over_icon) { GtkWidget *menu; GtkWidget *item; @@ -969,7 +969,7 @@ static void collection_table_set_focus(CollectTable *ct, CollectInfo *info) } } -static void collection_table_move_focus(CollectTable *ct, gint row, gint col, gint relative) +static void collection_table_move_focus(CollectTable *ct, gint row, gint col, gboolean relative) { gint new_row; gint new_col; @@ -1115,15 +1115,14 @@ static void collection_table_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboole popup_menu_position_clamp(menu, x, y, 0); } -static gint collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +static gboolean collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { CollectTable *ct = data; gint focus_row = 0; gint focus_col = 0; CollectInfo *info; - gint stop_signal; + gboolean stop_signal = TRUE; - stop_signal = TRUE; switch (event->keyval) { case GDK_Left: case GDK_KP_Left: @@ -1240,8 +1239,8 @@ static gint collection_table_press_key_cb(GtkWidget *widget, GdkEventKey *event, *------------------------------------------------------------------- */ -static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *source, gint *after, GdkRectangle *cell, - gint use_coord, gint x, gint y) +static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo *source, gboolean *after, GdkRectangle *cell, + gboolean use_coord, gint x, gint y) { CollectInfo *info = NULL; GtkTreeModel *store; @@ -1264,7 +1263,7 @@ static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo * gtk_tree_path_free(tpath); info = source; - *after = (x > cell->x + (cell->width / 2)); + *after = !!(x > cell->x + (cell->width / 2)); } return info; } @@ -1284,7 +1283,7 @@ static CollectInfo *collection_table_insert_find(CollectTable *ct, CollectInfo * if (info) { gtk_tree_view_get_background_area(GTK_TREE_VIEW(ct->listview), tpath, column, cell); - *after = (x > cell->x + (cell->width / 2)); + *after = !!(x > cell->x + (cell->width / 2)); } gtk_tree_path_free(tpath); @@ -1319,7 +1318,7 @@ static CollectInfo *collection_table_insert_point(CollectTable *ct, gint x, gint { CollectInfo *info; GdkRectangle cell; - gint after = FALSE; + gboolean after = FALSE; info = collection_table_insert_find(ct, NULL, &after, &cell, TRUE, x, y); @@ -1341,10 +1340,10 @@ static CollectInfo *collection_table_insert_point(CollectTable *ct, gint x, gint return info; } -static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, gint enable) +static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, gboolean enable) { gint row, col; - gint after = FALSE; + gboolean after = FALSE; GdkRectangle cell; if (!enable) @@ -1430,7 +1429,7 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info, *------------------------------------------------------------------- */ -static void collection_table_motion_update(CollectTable *ct, gint x, gint y, gint drop_event) +static void collection_table_motion_update(CollectTable *ct, gint x, gint y, gboolean drop_event) { CollectInfo *info; @@ -1447,7 +1446,7 @@ static void collection_table_motion_update(CollectTable *ct, gint x, gint y, gin } } -static gint collection_table_auto_scroll_idle_cb(gpointer data) +static gboolean collection_table_auto_scroll_idle_cb(gpointer data) { CollectTable *ct = data; GdkWindow *window; @@ -1468,7 +1467,7 @@ static gint collection_table_auto_scroll_idle_cb(gpointer data) return FALSE; } -static gint collection_table_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data) +static gboolean collection_table_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data) { CollectTable *ct = data; @@ -1477,7 +1476,7 @@ static gint collection_table_auto_scroll_notify_cb(GtkWidget *widget, gint x, gi return TRUE; } -static void collection_table_scroll(CollectTable *ct, gint scroll) +static void collection_table_scroll(CollectTable *ct, gboolean scroll) { if (!scroll) { @@ -1503,7 +1502,7 @@ static void collection_table_scroll(CollectTable *ct, gint scroll) *------------------------------------------------------------------- */ -static gint collection_table_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean collection_table_motion_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { CollectTable *ct = data; @@ -1512,7 +1511,7 @@ static gint collection_table_motion_cb(GtkWidget *widget, GdkEventButton *bevent return FALSE; } -static gint collection_table_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean collection_table_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { CollectTable *ct = data; GtkTreeIter iter; @@ -1551,7 +1550,7 @@ static gint collection_table_press_cb(GtkWidget *widget, GdkEventButton *bevent, return TRUE; } -static gint collection_table_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean collection_table_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { CollectTable *ct = data; GtkTreeIter iter; @@ -1559,7 +1558,7 @@ static gint collection_table_release_cb(GtkWidget *widget, GdkEventButton *beven tip_schedule(ct); - if ((gint)bevent->x != 0 || (gint) bevent->y != 0) + if ((gint)bevent->x != 0 || (gint)bevent->y != 0) { info = collection_table_find_data_by_coord(ct, (gint)bevent->x, (gint)bevent->y, &iter); } @@ -1576,9 +1575,8 @@ static gint collection_table_release_cb(GtkWidget *widget, GdkEventButton *beven if (bevent->state & GDK_CONTROL_MASK) { - gint select; + gboolean select = !INFO_SELECTED(info); - select = !INFO_SELECTED(info); if ((bevent->state & GDK_SHIFT_MASK) && ct->prev_selection) { collection_table_select_region_util(ct, ct->prev_selection, info, select); @@ -1612,7 +1610,7 @@ static gint collection_table_release_cb(GtkWidget *widget, GdkEventButton *beven return TRUE; } -static gint collection_table_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data) +static gboolean collection_table_leave_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data) { CollectTable *ct = data; @@ -1661,7 +1659,7 @@ static GList *collection_table_add_row(CollectTable *ct, GtkTreeIter *iter) return list; } -static void collection_table_populate(CollectTable *ct, gint resize) +static void collection_table_populate(CollectTable *ct, gboolean resize) { gint row; GList *work; @@ -1725,7 +1723,7 @@ static void collection_table_populate(CollectTable *ct, gint resize) collection_table_update_status(ct); } -static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gint force) +static void collection_table_populate_at_new_size(CollectTable *ct, gint w, gint h, gboolean force) { gint new_cols; gint thumb_width; @@ -1809,7 +1807,7 @@ static void collection_table_sync(CollectTable *ct) collection_table_update_status(ct); } -static gint collection_table_sync_idle_cb(gpointer data) +static gboolean collection_table_sync_idle_cb(gpointer data) { CollectTable *ct = data; @@ -1993,7 +1991,7 @@ void collection_table_refresh(CollectTable *ct) *------------------------------------------------------------------- */ -static void collection_table_add_dir_recursive(CollectTable *ct, FileData *dir_fd, gint recursive) +static void collection_table_add_dir_recursive(CollectTable *ct, FileData *dir_fd, gboolean recursive) { GList *d; GList *f; @@ -2021,7 +2019,7 @@ static void collection_table_add_dir_recursive(CollectTable *ct, FileData *dir_f filelist_free(d); } -static void confirm_dir_list_do(CollectTable *ct, GList *list, gint recursive) +static void confirm_dir_list_do(CollectTable *ct, GList *list, gboolean recursive) { GList *work = list; while (work) @@ -2102,7 +2100,7 @@ static void collection_table_dnd_get(GtkWidget *widget, GdkDragContext *context, guint time, gpointer data) { CollectTable *ct = data; - gint selected; + gboolean selected; GList *list = NULL; gchar *uri_text = NULL; gint total; @@ -2513,4 +2511,5 @@ CollectInfo *collection_table_get_focus_info(CollectTable *ct) { return collection_table_find_data(ct, ct->focus_row, ct->focus_column, NULL); } + /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ diff --git a/src/collect.c b/src/collect.c index 0d3c8d61..84f9b64c 100644 --- a/src/collect.c +++ b/src/collect.c @@ -94,7 +94,7 @@ void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf) ci->pixbuf = pixbuf; } -gint collection_info_load_thumb(CollectInfo *ci) +gboolean collection_info_load_thumb(CollectInfo *ci) { if (!ci) return FALSE; @@ -595,10 +595,10 @@ static CollectInfo *collection_info_new_if_not_exists(CollectionData *cd, struct return ci; } -gint collection_add_check(CollectionData *cd, FileData *fd, gint sorted, gint must_exist) +gboolean collection_add_check(CollectionData *cd, FileData *fd, gboolean sorted, gboolean must_exist) { struct stat st; - gint valid; + gboolean valid; if (must_exist) { @@ -635,12 +635,12 @@ gint collection_add_check(CollectionData *cd, FileData *fd, gint sorted, gint mu return valid; } -gint collection_add(CollectionData *cd, FileData *fd, gint sorted) +gboolean collection_add(CollectionData *cd, FileData *fd, gboolean sorted) { return collection_add_check(cd, fd, sorted, TRUE); } -gint collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gint sorted) +gboolean collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gboolean sorted) { struct stat st; @@ -666,7 +666,7 @@ gint collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, return FALSE; } -gint collection_remove(CollectionData *cd, FileData *fd) +gboolean collection_remove(CollectionData *cd, FileData *fd) { CollectInfo *ci; @@ -720,7 +720,7 @@ void collection_remove_by_info_list(CollectionData *cd, GList *list) collection_window_refresh(collection_window_find(cd)); } -gint collection_rename(CollectionData *cd, FileData *fd) +gboolean collection_rename(CollectionData *cd, FileData *fd) { CollectInfo *ci; ci = collection_list_find_fd(cd->list, fd); @@ -776,10 +776,10 @@ static void collection_notify_cb(FileData *fd, NotifyType type, gpointer data) *------------------------------------------------------------------- */ -static gint collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data) +static gboolean collection_window_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data) { CollectWindow *cw = data; - gint stop_signal = FALSE; + gboolean stop_signal = FALSE; gint edit_val = -1; GList *list; @@ -1137,7 +1137,7 @@ void collection_window_close_by_collection(CollectionData *cd) if (cw) collection_window_close_final(cw); } -gint collection_window_modified_exists(void) +gboolean collection_window_modified_exists(void) { GList *work; @@ -1152,7 +1152,7 @@ gint collection_window_modified_exists(void) return FALSE; } -static gint collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data) +static gboolean collection_window_delete(GtkWidget *widget, GdkEvent *event, gpointer data) { CollectWindow *cw = data; collection_window_close(cw); diff --git a/src/collect.h b/src/collect.h index 40e266f0..7aa96d3d 100644 --- a/src/collect.h +++ b/src/collect.h @@ -21,7 +21,7 @@ void collection_info_free_thumb(CollectInfo *ci); void collection_info_free(CollectInfo *ci); void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf); -gint collection_info_load_thumb(CollectInfo *ci); +gboolean collection_info_load_thumb(CollectInfo *ci); void collection_list_free(GList *list); @@ -62,12 +62,12 @@ void collection_set_sort_method(CollectionData *cd, SortType method); void collection_set_update_info_func(CollectionData *cd, void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data); -gint collection_add(CollectionData *cd, FileData *fd, gint sorted); -gint collection_add_check(CollectionData *cd, FileData *fd, gint sorted, gint must_exist); -gint collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gint sorted); -gint collection_remove(CollectionData *cd, FileData *fd); +gboolean collection_add(CollectionData *cd, FileData *fd, gboolean sorted); +gboolean collection_add_check(CollectionData *cd, FileData *fd, gboolean sorted, gboolean must_exist); +gboolean collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gboolean sorted); +gboolean collection_remove(CollectionData *cd, FileData *fd); void collection_remove_by_info_list(CollectionData *cd, GList *list); -gint collection_rename(CollectionData *cd, FileData *fd); +gboolean collection_rename(CollectionData *cd, FileData *fd); void collection_update_geometry(CollectionData *cd); @@ -75,7 +75,7 @@ CollectWindow *collection_window_new(const gchar *path); void collection_window_close_by_collection(CollectionData *cd); CollectWindow *collection_window_find(CollectionData *cd); CollectWindow *collection_window_find_by_path(const gchar *path); -gint collection_window_modified_exists(void); +gboolean collection_window_modified_exists(void); #endif diff --git a/src/color-man.c b/src/color-man.c index 92473d5d..eb3364fb 100644 --- a/src/color-man.c +++ b/src/color-man.c @@ -36,7 +36,7 @@ struct _ColorManCache { ColorManProfileType profile_out_type; gchar *profile_out_file; - gint has_alpha; + gboolean has_alpha; gint refcount; }; @@ -47,7 +47,7 @@ struct _ColorManCache { static void color_man_lib_init(void) { - static gint init_done = FALSE; + static gboolean init_done = FALSE; if (init_done) return; init_done = TRUE; @@ -136,7 +136,7 @@ static cmsHPROFILE color_man_cache_load_profile(ColorManProfileType type, const static ColorManCache *color_man_cache_new(ColorManProfileType in_type, const gchar *in_file, guchar *in_data, guint in_data_len, ColorManProfileType out_type, const gchar *out_file, - gint has_alpha) + gboolean has_alpha) { ColorManCache *cc; @@ -213,7 +213,7 @@ static void color_man_cache_reset(void) static ColorManCache *color_man_cache_find(ColorManProfileType in_type, const gchar *in_file, ColorManProfileType out_type, const gchar *out_file, - gint has_alpha) + gboolean has_alpha) { GList *work; @@ -221,7 +221,7 @@ static ColorManCache *color_man_cache_find(ColorManProfileType in_type, const gc while (work) { ColorManCache *cc; - gint match = FALSE; + gboolean match = FALSE; cc = work->data; work = work->next; @@ -253,7 +253,7 @@ static ColorManCache *color_man_cache_find(ColorManProfileType in_type, const gc static ColorManCache *color_man_cache_get(ColorManProfileType in_type, const gchar *in_file, guchar *in_data, guint in_data_len, ColorManProfileType out_type, const gchar *out_file, - gint has_alpha) + gboolean has_alpha) { ColorManCache *cc; @@ -315,11 +315,12 @@ void color_man_correct_region(ColorMan *cm, GdkPixbuf *pixbuf, gint x, gint y, g } -static gint color_man_idle_cb(gpointer data) +static gboolean color_man_idle_cb(gpointer data) { ColorMan *cm = data; gint width, height; gint rh; + if (!cm->pixbuf) return FALSE; if (cm->imd && @@ -359,7 +360,7 @@ static ColorMan *color_man_new_real(ImageWindow *imd, GdkPixbuf *pixbuf, ColorManProfileType screen_type, const gchar *screen_file) { ColorMan *cm; - gint has_alpha; + gboolean has_alpha; if (imd) pixbuf = image_get_pixbuf(imd); diff --git a/src/dnd.c b/src/dnd.c index 2cae9f2c..932248ef 100644 --- a/src/dnd.c +++ b/src/dnd.c @@ -38,7 +38,7 @@ gint dnd_file_drop_types_count = 3; static void pixbuf_draw_border(GdkPixbuf *pixbuf, gint w, gint h) { - gint alpha; + gboolean alpha; gint rs; guchar *pix; guchar *p; @@ -74,7 +74,7 @@ static void pixbuf_draw_border(GdkPixbuf *pixbuf, gint w, gint h) static void pixbuf_draw_rect(GdkPixbuf *pixbuf, gint x, gint y, gint w, gint h, guint8 val) { - gint alpha; + gboolean alpha; gint rs; guchar *pix; guchar *p; diff --git a/src/dupe.c b/src/dupe.c index 6b59aa9c..79ab5145 100644 --- a/src/dupe.c +++ b/src/dupe.c @@ -91,7 +91,7 @@ static void dupe_notify_cb(FileData *fd, NotifyType type, gpointer data); */ -static void dupe_window_update_count(DupeWindow *dw, gint count_only) +static void dupe_window_update_count(DupeWindow *dw, gboolean count_only) { gchar *text; @@ -133,7 +133,7 @@ static gint dupe_iterations(gint n) return (n * ((n + 1) / 2)); } -static void dupe_window_update_progress(DupeWindow *dw, const gchar *status, gdouble value, gint force) +static void dupe_window_update_progress(DupeWindow *dw, const gchar *status, gdouble value, gboolean force) { const gchar *status_text; @@ -681,13 +681,13 @@ static GList *dupe_listview_get_selection(DupeWindow *dw, GtkWidget *listview) return g_list_reverse(list); } -static gint dupe_listview_item_is_selected(DupeWindow *dw, DupeItem *di, GtkWidget *listview) +static gboolean dupe_listview_item_is_selected(DupeWindow *dw, DupeItem *di, GtkWidget *listview) { GtkTreeModel *store; GtkTreeSelection *selection; GList *slist; GList *work; - gint found = FALSE; + gboolean found = FALSE; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(listview)); slist = gtk_tree_selection_get_selected_rows(selection, &store); @@ -788,7 +788,7 @@ static void dupe_match_unlink(DupeItem *a, DupeItem *b) dupe_match_unlink_child(b, a); } -static void dupe_match_link_clear(DupeItem *parent, gint unlink_children) +static void dupe_match_link_clear(DupeItem *parent, gboolean unlink_children) { GList *work; @@ -1112,7 +1112,7 @@ static void dupe_match_rank(DupeWindow *dw) * ------------------------------------------------------------------ */ -static gint dupe_match(DupeItem *a, DupeItem *b, DupeMatchType mask, gdouble *rank, gint fast) +static gboolean dupe_match(DupeItem *a, DupeItem *b, DupeMatchType mask, gdouble *rank, gint fast) { *rank = 0.0; @@ -1420,7 +1420,7 @@ static GList *dupe_setup_point_step(DupeWindow *dw, GList *p) return NULL; } -static gint dupe_check_cb(gpointer data) +static gboolean dupe_check_cb(gpointer data) { DupeWindow *dw = data; @@ -1696,7 +1696,7 @@ static void dupe_item_remove(DupeWindow *dw, DupeItem *di) dupe_window_update_count(dw, FALSE); } -static gint dupe_item_remove_by_path(DupeWindow *dw, const gchar *path) +static gboolean dupe_item_remove_by_path(DupeWindow *dw, const gchar *path) { DupeItem *di; @@ -1709,7 +1709,7 @@ static gint dupe_item_remove_by_path(DupeWindow *dw, const gchar *path) } static void dupe_files_add(DupeWindow *dw, CollectionData *collection, CollectInfo *info, - FileData *fd, gint recurse) + FileData *fd, gboolean recurse) { DupeItem *di = NULL; @@ -1777,7 +1777,7 @@ void dupe_window_add_collection(DupeWindow *dw, CollectionData *collection) dupe_check_start(dw); } -void dupe_window_add_files(DupeWindow *dw, GList *list, gint recurse) +void dupe_window_add_files(DupeWindow *dw, GList *list, gboolean recurse) { GList *work; @@ -2293,7 +2293,7 @@ static GtkWidget *dupe_menu_popup_main(DupeWindow *dw, DupeItem *di) return menu; } -static gint dupe_listview_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean dupe_listview_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { DupeWindow *dw = data; GtkTreeModel *store; @@ -2376,7 +2376,7 @@ static gint dupe_listview_press_cb(GtkWidget *widget, GdkEventButton *bevent, gp return FALSE; } -static gint dupe_listview_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean dupe_listview_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { DupeWindow *dw = data; GtkTreeModel *store; @@ -2555,11 +2555,8 @@ static void dupe_second_menu_clear_cb(GtkWidget *widget, gpointer data) static GtkWidget *dupe_menu_popup_second(DupeWindow *dw, DupeItem *di) { GtkWidget *menu; - gint notempty; - gint on_row; - - on_row = (di != NULL); - notempty = (dw->second_list != NULL); + gboolean notempty = (dw->second_list != NULL); + gboolean on_row = (di != NULL); menu = popup_menu_short_lived(); menu_item_add_sensitive(menu, _("_View"), on_row, @@ -2724,7 +2721,7 @@ static void dupe_listview_color_cb(GtkTreeViewColumn *tree_column, GtkCellRender "cell-background-set", set, NULL); } -static void dupe_listview_add_column(DupeWindow *dw, GtkWidget *listview, gint n, const gchar *title, gint image, gint right_justify) +static void dupe_listview_add_column(DupeWindow *dw, GtkWidget *listview, gint n, const gchar *title, gboolean image, gboolean right_justify) { GtkTreeViewColumn *column; GtkCellRenderer *renderer; @@ -2768,7 +2765,7 @@ static void dupe_listview_add_column(DupeWindow *dw, GtkWidget *listview, gint n gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); } -static void dupe_listview_set_height(GtkWidget *listview, gint thumb) +static void dupe_listview_set_height(GtkWidget *listview, gboolean thumb) { GtkTreeViewColumn *column; GtkCellRenderer *cell; @@ -2855,11 +2852,11 @@ static void dupe_popup_menu_pos_cb(GtkMenu *menu, gint *x, gint *y, gboolean *pu *y = cy; } -static gint dupe_window_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +static gboolean dupe_window_keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { DupeWindow *dw = data; - gint stop_signal = FALSE; - gint on_second; + gboolean stop_signal = FALSE; + gboolean on_second; GtkWidget *listview; GtkTreeModel *store; GtkTreeSelection *selection; @@ -3470,7 +3467,7 @@ static void dupe_dnd_data_get(GtkWidget *widget, GdkDragContext *context, } } -static void dupe_dest_set(GtkWidget *widget, gint enable) +static void dupe_dest_set(GtkWidget *widget, gboolean enable) { if (enable) { diff --git a/src/dupe.h b/src/dupe.h index f27e4ed2..b4dad570 100644 --- a/src/dupe.h +++ b/src/dupe.h @@ -79,7 +79,7 @@ struct _DupeWindow GtkWidget *extra_label; GtkWidget *button_thumbs; - gint show_thumbs; + gboolean show_thumbs; gint idle_id; GList *working; @@ -100,15 +100,15 @@ struct _DupeWindow /* second set comparison stuff */ - gint second_set; /* second set enabled ? */ + gboolean second_set; /* second set enabled ? */ GList *second_list; /* second set dropped files */ - gint second_drop; /* drop is on second set */ + gboolean second_drop; /* drop is on second set */ GtkWidget *second_vbox; /* box of second widgets */ GtkWidget *second_listview; GtkWidget *second_status_label; - gint color_frozen; + gboolean color_frozen; /* file list for edit menu */ GList *editmenu_fd_list; @@ -122,7 +122,7 @@ void dupe_window_clear(DupeWindow *dw); void dupe_window_close(DupeWindow *dw); void dupe_window_add_collection(DupeWindow *dw, CollectionData *collection); -void dupe_window_add_files(DupeWindow *dw, GList *list, gint recurse); +void dupe_window_add_files(DupeWindow *dw, GList *list, gboolean recurse); /* cell max with/height hack utility */ void cell_renderer_height_override(GtkCellRenderer *renderer); diff --git a/src/similar.c b/src/similar.c index 0daea4fe..de28fd96 100644 --- a/src/similar.c +++ b/src/similar.c @@ -44,14 +44,14 @@ * improve the result, and hopes to reduce false positives. */ -static gint alternate_enabled = FALSE; +static gboolean alternate_enabled = FALSE; -void image_sim_alternate_set(gint enable) +void image_sim_alternate_set(gboolean enable) { alternate_enabled = enable; } -gint image_sim_alternate_enabled(void) +gboolean image_sim_alternate_enabled(void) { return alternate_enabled; } @@ -183,8 +183,8 @@ void image_sim_fill_data(ImageSimilarityData *sd, GdkPixbuf *pixbuf) gint x_inc, y_inc, xy_inc; gint xs, ys; - gint x_small = FALSE; /* if less than 32 w or h, set TRUE */ - gint y_small = FALSE; + gboolean x_small = FALSE; /* if less than 32 w or h, set TRUE */ + gboolean y_small = FALSE; if (!sd || !pixbuf) return; diff --git a/src/similar.h b/src/similar.h index 64051fcc..5288c0b6 100644 --- a/src/similar.h +++ b/src/similar.h @@ -22,7 +22,7 @@ struct _ImageSimilarityData guint8 avg_g[1024]; guint8 avg_b[1024]; - gint filled; + gboolean filled; }; @@ -36,8 +36,8 @@ gdouble image_sim_compare(ImageSimilarityData *a, ImageSimilarityData *b); gdouble image_sim_compare_fast(ImageSimilarityData *a, ImageSimilarityData *b, gdouble min); -void image_sim_alternate_set(gint enable); -gint image_sim_alternate_enabled(void); +void image_sim_alternate_set(gboolean enable); +gboolean image_sim_alternate_enabled(void); void image_sim_alternate_processing(ImageSimilarityData *sd); -- 2.20.1