Mercurial > geeqie.yaz
changeset 1433:b4ad1d201279
Use gboolean where applicable, minor cleanup and indentations fixes.
author | zas_ |
---|---|
date | Sat, 14 Mar 2009 19:25:21 +0000 |
parents | cf4029d10d38 |
children | b106af9689db |
files | src/image-load.c src/image-load.h src/image-overlay.c src/img-view.c src/img-view.h src/layout.c src/layout_image.c src/layout_image.h src/layout_util.c src/layout_util.h src/slideshow.c src/slideshow.h src/typedefs.h |
diffstat | 13 files changed, 109 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/src/image-load.c Sat Mar 14 17:21:35 2009 +0000 +++ b/src/image-load.c Sat Mar 14 19:25:21 2009 +0000 @@ -220,7 +220,7 @@ }; -static gint image_loader_emit_area_ready_cb(gpointer data) +static gboolean image_loader_emit_area_ready_cb(gpointer data) { ImageLoaderAreaParam *par = data; ImageLoader *il = par->il; @@ -233,21 +233,21 @@ return FALSE; } -static gint image_loader_emit_done_cb(gpointer data) +static gboolean image_loader_emit_done_cb(gpointer data) { ImageLoader *il = data; g_signal_emit(il, signals[SIGNAL_DONE], 0); return FALSE; } -static gint image_loader_emit_error_cb(gpointer data) +static gboolean image_loader_emit_error_cb(gpointer data) { ImageLoader *il = data; g_signal_emit(il, signals[SIGNAL_ERROR], 0); return FALSE; } -static gint image_loader_emit_percent_cb(gpointer data) +static gboolean image_loader_emit_percent_cb(gpointer data) { ImageLoader *il = data; g_signal_emit(il, signals[SIGNAL_PERCENT], 0, image_loader_get_percent(il)); @@ -306,9 +306,9 @@ -static gint image_loader_get_stopping(ImageLoader *il) +static gboolean image_loader_get_stopping(ImageLoader *il) { - gint ret; + gboolean ret; if (!il) return FALSE; g_mutex_lock(il->data_mutex); @@ -402,7 +402,7 @@ ImageLoader *il = data; GdkPixbufFormat *format; gchar **mime_types; - gint scale = FALSE; + gboolean scale = FALSE; gint n; g_mutex_lock(il->data_mutex); @@ -501,7 +501,7 @@ image_loader_emit_error(il); } -static gint image_loader_continue(ImageLoader *il) +static gboolean image_loader_continue(ImageLoader *il) { gint b; gint c; @@ -538,9 +538,9 @@ return TRUE; } -static gint image_loader_begin(ImageLoader *il) +static gboolean image_loader_begin(ImageLoader *il) { - gint b; + gssize b; if (il->pixbuf) return FALSE; @@ -594,7 +594,7 @@ /* the following functions are always executed in the main thread */ -static gint image_loader_setup_source(ImageLoader *il) +static gboolean image_loader_setup_source(ImageLoader *il) { struct stat st; gchar *pathl; @@ -696,7 +696,7 @@ } -void image_loader_delay_area_ready(ImageLoader *il, gint enable) +void image_loader_delay_area_ready(ImageLoader *il, gboolean enable) { g_mutex_lock(il->data_mutex); il->delay_area_ready = enable; @@ -731,25 +731,29 @@ /**************************************************************************************/ /* execution via idle calls */ -static gint image_loader_idle_cb(gpointer data) +static gboolean image_loader_idle_cb(gpointer data) { - gint ret = FALSE; + gboolean ret = FALSE; ImageLoader *il = data; + if (il->idle_id != -1) { ret = image_loader_continue(il); } + if (!ret) { image_loader_stop_source(il); } + return ret; } -gint image_loader_start_idle(ImageLoader *il) +static gboolean image_loader_start_idle(ImageLoader *il) { - gint ret; + gboolean ret; + if (!il) return FALSE; if (!il->fd) return FALSE; @@ -798,10 +802,10 @@ } -void image_loader_thread_run(gpointer data, gpointer user_data) +static void image_loader_thread_run(gpointer data, gpointer user_data) { ImageLoader *il = data; - gint cont; + gboolean cont; if (il->idle_priority > G_PRIORITY_DEFAULT_IDLE) { @@ -851,7 +855,7 @@ } -gint image_loader_start_thread(ImageLoader *il) +static gboolean image_loader_start_thread(ImageLoader *il) { if (!il) return FALSE; @@ -881,7 +885,7 @@ /* public interface */ -gint image_loader_start(ImageLoader *il) +gboolean image_loader_start(ImageLoader *il) { if (!il) return FALSE; @@ -974,9 +978,9 @@ return ret; } -gint image_loader_get_is_done(ImageLoader *il) +gboolean image_loader_get_is_done(ImageLoader *il) { - gint ret; + gboolean ret; if (!il) return FALSE; g_mutex_lock(il->data_mutex); @@ -998,9 +1002,9 @@ return ret; } -gint image_loader_get_shrunk(ImageLoader *il) +gboolean image_loader_get_shrunk(ImageLoader *il) { - gint ret; + gboolean ret; if (!il) return FALSE; g_mutex_lock(il->data_mutex); @@ -1011,10 +1015,10 @@ /* FIXME - this can be rather slow and blocks until the size is known */ -gint image_load_dimensions(FileData *fd, gint *width, gint *height) +gboolean image_load_dimensions(FileData *fd, gint *width, gint *height) { ImageLoader *il; - gint success; + gboolean success; il = image_loader_new(fd);
--- a/src/image-load.h Sat Mar 14 17:21:35 2009 +0000 +++ b/src/image-load.h Sat Mar 14 19:25:21 2009 +0000 @@ -31,13 +31,13 @@ gsize bytes_read; gsize bytes_total; - gint preview; + gboolean preview; gint requested_width; gint requested_height; - gint shrunk; + gboolean shrunk; - gint done; + gboolean done; gint idle_id; gint idle_priority; @@ -47,11 +47,11 @@ GList *area_param_list; GList *area_param_delayed_list; - gint delay_area_ready; + gboolean delay_area_ready; GMutex *data_mutex; - gint stopping; - gint can_destroy; + gboolean stopping; + gboolean can_destroy; GCond *can_destroy_cond; gboolean thread; @@ -77,7 +77,7 @@ void image_loader_free(ImageLoader *il); /* delay area_ready signals */ -void image_loader_delay_area_ready(ImageLoader *il, gint enable); +void image_loader_delay_area_ready(ImageLoader *il, gboolean enable); /* Speed up loading when you only need at most width x height size image, * only the jpeg GdkPixbuf loader benefits from it - so there is no @@ -92,17 +92,17 @@ */ void image_loader_set_priority(ImageLoader *il, gint priority); -gint image_loader_start(ImageLoader *il); +gboolean image_loader_start(ImageLoader *il); GdkPixbuf *image_loader_get_pixbuf(ImageLoader *il); gchar *image_loader_get_format(ImageLoader *il); gdouble image_loader_get_percent(ImageLoader *il); -gint image_loader_get_is_done(ImageLoader *il); +gboolean image_loader_get_is_done(ImageLoader *il); FileData *image_loader_get_fd(ImageLoader *il); -gint image_loader_get_shrunk(ImageLoader *il); +gboolean image_loader_get_shrunk(ImageLoader *il); -gint image_load_dimensions(FileData *fd, gint *width, gint *height); +gboolean image_load_dimensions(FileData *fd, gint *width, gint *height); #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/image-overlay.c Sat Mar 14 17:21:35 2009 +0000 +++ b/src/image-overlay.c Sat Mar 14 19:25:21 2009 +0000 @@ -58,7 +58,7 @@ typedef struct _OSDIcon OSDIcon; struct _OSDIcon { - gint reset; /* reset on new image */ + gboolean reset; /* reset on new image */ gint x; /* x, y offset */ gint y; gchar *key; /* inline pixbuf */ @@ -818,7 +818,7 @@ osd->ovl_info = 0; } -static gint image_osd_update_cb(gpointer data) +static gboolean image_osd_update_cb(gpointer data) { OverlayStateData *osd = data; @@ -888,7 +888,7 @@ return FALSE; } -static void image_osd_update_schedule(OverlayStateData *osd, gint force) +static void image_osd_update_schedule(OverlayStateData *osd, gboolean force) { if (force) osd->changed_states |= IMAGE_STATE_IMAGE; @@ -907,11 +907,11 @@ image_osd_update_schedule(osd, TRUE); } -static gint image_osd_timer_cb(gpointer data) +static gboolean image_osd_timer_cb(gpointer data) { OverlayStateData *osd = data; - gint done = TRUE; - gint changed = FALSE; + gboolean done = TRUE; + gboolean changed = FALSE; gint i; for (i = 0; i < IMAGE_OSD_COUNT; i++)
--- a/src/img-view.c Sat Mar 14 17:21:35 2009 +0000 +++ b/src/img-view.c Sat Mar 14 19:25:21 2009 +0000 @@ -59,7 +59,7 @@ static GtkWidget *view_popup_menu(ViewWindow *vw); -static void view_fullscreen_toggle(ViewWindow *vw, gint force_off); +static void view_fullscreen_toggle(ViewWindow *vw, gboolean force_off); static void view_overlay_toggle(ViewWindow *vw); static void view_slideshow_next(ViewWindow *vw); @@ -96,7 +96,7 @@ vw->list = filelist_copy(list); } -static gint view_window_contains_collection(ViewWindow *vw) +static gboolean view_window_contains_collection(ViewWindow *vw) { CollectionData *cd; CollectInfo *info; @@ -106,7 +106,7 @@ return (cd && info); } -static void view_collection_step(ViewWindow *vw, gint next) +static void view_collection_step(ViewWindow *vw, gboolean next) { ImageWindow *imd = view_window_active_image(vw); CollectionData *cd; @@ -145,7 +145,7 @@ } -static void view_collection_step_to_end(ViewWindow *vw, gint last) +static void view_collection_step_to_end(ViewWindow *vw, gboolean last) { ImageWindow *imd = view_window_active_image(vw); CollectionData *cd; @@ -174,7 +174,7 @@ } } -static void view_list_step(ViewWindow *vw, gint next) +static void view_list_step(ViewWindow *vw, gboolean next) { ImageWindow *imd = view_window_active_image(vw); FileData *fd; @@ -192,7 +192,7 @@ } else { - gint found = FALSE; + gboolean found = FALSE; work = vw->list; while (work && !found) @@ -238,7 +238,7 @@ } } -static void view_list_step_to_end(ViewWindow *vw, gint last) +static void view_list_step_to_end(ViewWindow *vw, gboolean last) { ImageWindow *imd = view_window_active_image(vw); FileData *fd; @@ -301,7 +301,7 @@ } } -static void view_step_to_end(ViewWindow *vw, gint last) +static void view_step_to_end(ViewWindow *vw, gboolean last) { if (vw->list) { @@ -329,7 +329,7 @@ popup_menu_position_clamp(menu, x, y, 0); } -static gint view_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +static gboolean view_window_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { ViewWindow *vw = data; ImageWindow *imd; @@ -690,7 +690,7 @@ if (vw->ss) vw->ss->imd = vw->imd; } -static void view_fullscreen_toggle(ViewWindow *vw, gint force_off) +static void view_fullscreen_toggle(ViewWindow *vw, gboolean force_off) { if (force_off && !vw->fs) return; @@ -818,7 +818,7 @@ gtk_widget_destroy(vw->window); } -static gint view_window_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data) +static gboolean view_window_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data) { ViewWindow *vw = data; @@ -1007,7 +1007,7 @@ } } -gint view_window_find_image(ImageWindow *imd, gint *index, gint *total) +gboolean view_window_find_image(ImageWindow *imd, gint *index, gint *total) { GList *work; @@ -1354,7 +1354,7 @@ /* do nothing */ } -static void view_dir_list_do(ViewWindow *vw, GList *list, gint skip, gint recurse) +static void view_dir_list_do(ViewWindow *vw, GList *list, gboolean skip, gboolean recurse) { GList *work; @@ -1561,7 +1561,7 @@ { gchar *text = NULL; gint len; - gint plain_text; + gboolean plain_text; GList *list; switch (info)
--- a/src/img-view.h Sat Mar 14 17:21:35 2009 +0000 +++ b/src/img-view.h Sat Mar 14 19:25:21 2009 +0000 @@ -21,7 +21,7 @@ void view_window_colors_update(void); -gint view_window_find_image(ImageWindow *imd, gint *index, gint *total); +gboolean view_window_find_image(ImageWindow *imd, gint *index, gint *total);
--- a/src/layout.c Sat Mar 14 17:21:35 2009 +0000 +++ b/src/layout.c Sat Mar 14 19:25:21 2009 +0000 @@ -726,7 +726,7 @@ layout_status_update_write(lw); } -static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gint start, gint size, gint expand) +static GtkWidget *layout_status_label(gchar *text, GtkWidget *box, gboolean start, gint size, gboolean expand) { GtkWidget *label; GtkWidget *frame; @@ -751,7 +751,7 @@ return label; } -static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gint small_format) +static void layout_status_setup(LayoutWindow *lw, GtkWidget *box, gboolean small_format) { GtkWidget *hbox; @@ -1374,7 +1374,7 @@ lw->options.tools_hidden = hide; } -static gint layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) +static gboolean layout_tools_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) { LayoutWindow *lw = data; @@ -1387,7 +1387,7 @@ { GtkWidget *vbox; GtkWidget *w1, *w2; - gint vertical; + gboolean vertical; gboolean new_window = FALSE; vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) || @@ -2001,7 +2001,7 @@ g_free(lw); } -static gint layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) +static gboolean layout_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) { LayoutWindow *lw = data;
--- a/src/layout_image.c Sat Mar 14 17:21:35 2009 +0000 +++ b/src/layout_image.c Sat Mar 14 19:25:21 2009 +0000 @@ -132,7 +132,7 @@ } } -gint layout_image_full_screen_active(LayoutWindow *lw) +gboolean layout_image_full_screen_active(LayoutWindow *lw) { if (!layout_valid(&lw)) return FALSE; @@ -229,16 +229,16 @@ } } -gint layout_image_slideshow_active(LayoutWindow *lw) +gboolean layout_image_slideshow_active(LayoutWindow *lw) { if (!layout_valid(&lw)) return FALSE; return (lw->slideshow != NULL); } -gint layout_image_slideshow_pause_toggle(LayoutWindow *lw) +gboolean layout_image_slideshow_pause_toggle(LayoutWindow *lw) { - gint ret; + gboolean ret; if (!layout_valid(&lw)) return FALSE; @@ -249,14 +249,14 @@ return ret; } -gint layout_image_slideshow_paused(LayoutWindow *lw) +gboolean layout_image_slideshow_paused(LayoutWindow *lw) { if (!layout_valid(&lw)) return FALSE; return (slideshow_paused(lw->slideshow)); } -static gint layout_image_slideshow_continue_check(LayoutWindow *lw) +static gboolean layout_image_slideshow_continue_check(LayoutWindow *lw) { if (!lw->slideshow) return FALSE; @@ -444,10 +444,10 @@ if (fd) layout_set_fd(lw, fd); } -static gint li_check_if_current_path(LayoutWindow *lw, const gchar *path) +static gboolean li_check_if_current_path(LayoutWindow *lw, const gchar *path) { gchar *dirname; - gint ret; + gboolean ret; if (!path || !layout_valid(&lw) || !lw->dir_fd) return FALSE; @@ -482,7 +482,7 @@ GtkWidget *item; GtkWidget *submenu; const gchar *path; - gint fullscreen; + gboolean fullscreen; path = layout_image_get_path(lw); fullscreen = layout_image_full_screen_active(lw); @@ -700,7 +700,7 @@ { gchar *text = NULL; gint len; - gint plain_text; + gboolean plain_text; GList *list; switch (info) @@ -1023,7 +1023,7 @@ layout_image_set_with_ahead(lw, fd, read_ahead_fd); } -static void layout_image_set_collection_real(LayoutWindow *lw, CollectionData *cd, CollectInfo *info, gint forward) +static void layout_image_set_collection_real(LayoutWindow *lw, CollectionData *cd, CollectInfo *info, gboolean forward) { if (!layout_valid(&lw)) return; @@ -1508,14 +1508,14 @@ /* Returns the length of an integer */ static gint num_length(gint num) { - gint len = 0; - if (num < 0) num = -num; - while (num) - { - num /= 10; - len++; - } - return len; + gint len = 0; + if (num < 0) num = -num; + while (num) + { + num /= 10; + len++; + } + return len; } void layout_status_update_pixel_cb(PixbufRenderer *pr, gpointer data) @@ -1611,7 +1611,6 @@ void layout_image_deactivate(LayoutWindow *lw, gint i) { - if (!lw->split_images[i]) return; image_set_update_func(lw->split_images[i], NULL, NULL); layout_image_set_buttons_inactive(lw, i);
--- a/src/layout_image.h Sat Mar 14 17:21:35 2009 +0000 +++ b/src/layout_image.h Sat Mar 14 19:25:21 2009 +0000 @@ -65,15 +65,15 @@ void layout_image_full_screen_start(LayoutWindow *lw); void layout_image_full_screen_stop(LayoutWindow *lw); void layout_image_full_screen_toggle(LayoutWindow *lw); -gint layout_image_full_screen_active(LayoutWindow *lw); +gboolean layout_image_full_screen_active(LayoutWindow *lw); void layout_image_slideshow_start(LayoutWindow *lw); void layout_image_slideshow_start_from_list(LayoutWindow *lw, GList *list); void layout_image_slideshow_stop(LayoutWindow *lw); void layout_image_slideshow_toggle(LayoutWindow *lw); -gint layout_image_slideshow_active(LayoutWindow *lw); -gint layout_image_slideshow_pause_toggle(LayoutWindow *lw); -gint layout_image_slideshow_paused(LayoutWindow *lw); +gboolean layout_image_slideshow_active(LayoutWindow *lw); +gboolean layout_image_slideshow_pause_toggle(LayoutWindow *lw); +gboolean layout_image_slideshow_paused(LayoutWindow *lw); void layout_image_overlay_toggle(LayoutWindow *lw);
--- a/src/layout_util.c Sat Mar 14 17:21:35 2009 +0000 +++ b/src/layout_util.c Sat Mar 14 19:25:21 2009 +0000 @@ -78,10 +78,10 @@ return FALSE; } -gint layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +gboolean layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { LayoutWindow *lw = data; - gint stop_signal = FALSE; + gboolean stop_signal = FALSE; gint x = 0; gint y = 0; @@ -1486,7 +1486,8 @@ return (gchar *)(_(path)); } -static void layout_actions_setup_mark(LayoutWindow *lw, gint mark, gchar *name_tmpl, gchar *label_tmpl, gchar *accel_tmpl, GCallback cb) +static void layout_actions_setup_mark(LayoutWindow *lw, gint mark, gchar *name_tmpl, + gchar *label_tmpl, gchar *accel_tmpl, GCallback cb) { gchar name[50]; gchar label[100]; @@ -2140,14 +2141,13 @@ void layout_exif_window_new(LayoutWindow *lw) { - if (!lw->exif_window) - { - lw->exif_window = advanced_exif_new(); - if (!lw->exif_window) return; - g_signal_connect(G_OBJECT(lw->exif_window), "destroy", - G_CALLBACK(layout_exif_window_destroy), lw); - advanced_exif_set_fd(lw->exif_window, layout_image_get_fd(lw)); - } + if (lw->exif_window) return; + + lw->exif_window = advanced_exif_new(); + if (!lw->exif_window) return; + g_signal_connect(G_OBJECT(lw->exif_window), "destroy", + G_CALLBACK(layout_exif_window_destroy), lw); + advanced_exif_set_fd(lw->exif_window, layout_image_get_fd(lw)); } /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/layout_util.h Sat Mar 14 17:21:35 2009 +0000 +++ b/src/layout_util.h Sat Mar 14 19:25:21 2009 +0000 @@ -17,7 +17,7 @@ #include "layout.h" -gint layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); +gboolean layout_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); void layout_util_sync_thumb(LayoutWindow *lw); void layout_util_sync(LayoutWindow *lw);
--- a/src/slideshow.c Sat Mar 14 17:21:35 2009 +0000 +++ b/src/slideshow.c Sat Mar 14 19:25:21 2009 +0000 @@ -434,21 +434,21 @@ return real_slideshow_start(imd, lw, NULL, start_point, NULL, NULL, stop_func, stop_data); } -gint slideshow_paused(SlideShowData *ss) +gboolean slideshow_paused(SlideShowData *ss) { if (!ss) return FALSE; return ss->paused; } -void slideshow_pause_set(SlideShowData *ss, gint paused) +void slideshow_pause_set(SlideShowData *ss, gboolean paused) { if (!ss) return; ss->paused = paused; } -gint slideshow_pause_toggle(SlideShowData *ss) +gboolean slideshow_pause_toggle(SlideShowData *ss) { slideshow_pause_set(ss, !slideshow_paused(ss)); return slideshow_paused(ss);
--- a/src/slideshow.h Sat Mar 14 17:21:35 2009 +0000 +++ b/src/slideshow.h Sat Mar 14 19:25:21 2009 +0000 @@ -39,9 +39,9 @@ SlideShowData *slideshow_start(ImageWindow *imd, LayoutWindow *lw, gint start_point, void (*stop_func)(SlideShowData *, gpointer), gpointer stop_data); -gint slideshow_paused(SlideShowData *ss); -void slideshow_pause_set(SlideShowData *ss, gint paused); -gint slideshow_pause_toggle(SlideShowData *ss); +gboolean slideshow_paused(SlideShowData *ss); +void slideshow_pause_set(SlideShowData *ss, gboolean paused); +gboolean slideshow_pause_toggle(SlideShowData *ss); #endif