# HG changeset patch # User zas_ # Date 1237030003 0 # Node ID 7e180091e0b76d940d99e02c6f65654dc0ca990a # Parent 7718e351bc45db369391f7970cde2c2c70d62369 More gboolean and tidy up. diff -r 7718e351bc45 -r 7e180091e0b7 src/fullscreen.c --- a/src/fullscreen.c Sat Mar 14 10:34:42 2009 +0000 +++ b/src/fullscreen.c Sat Mar 14 11:26:43 2009 +0000 @@ -70,7 +70,7 @@ } } -static gint fullscreen_hide_mouse_cb(gpointer data) +static gboolean fullscreen_hide_mouse_cb(gpointer data) { FullScreenData *fs = data; @@ -98,7 +98,7 @@ fs->hide_mouse_id = g_timeout_add(FULL_SCREEN_HIDE_MOUSE_DELAY, fullscreen_hide_mouse_cb, fs); } -static gint fullscreen_mouse_moved(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +static gboolean fullscreen_mouse_moved(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { FullScreenData *fs = data; @@ -121,11 +121,11 @@ } } -static void fullscreen_mouse_set_busy(FullScreenData *fs, gint busy) +static void fullscreen_mouse_set_busy(FullScreenData *fs, gboolean busy) { fullscreen_busy_mouse_disable(fs); - if ((fs->cursor_state & FULLSCREEN_CURSOR_BUSY) == (busy)) return; + if (!!(fs->cursor_state & FULLSCREEN_CURSOR_BUSY) == (busy)) return; if (busy) { @@ -168,7 +168,7 @@ } } -static void fullscreen_image_complete_cb(ImageWindow *imd, gint preload, gpointer data) +static void fullscreen_image_complete_cb(ImageWindow *imd, gboolean preload, gpointer data) { FullScreenData *fs = data; @@ -205,7 +205,7 @@ return TRUE; } -static gint fullscreen_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) +static gboolean fullscreen_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) { FullScreenData *fs = data; @@ -218,7 +218,7 @@ { FullScreenData *fs; GdkScreen *screen; - gint same; + gboolean same; gint x, y; gint w, h; GdkGeometry geometry; @@ -467,7 +467,7 @@ * same_region: the returned region will overlap the current location of widget. */ void fullscreen_prefs_get_geometry(gint screen, GtkWidget *widget, gint *x, gint *y, gint *width, gint *height, - GdkScreen **dest_screen, gint *same_region) + GdkScreen **dest_screen, gboolean *same_region) { GList *list; ScreenData *sd; @@ -610,7 +610,7 @@ FS_MENU_COLUMN_VALUE, value, -1); } -GtkWidget *fullscreen_prefs_selection_new(const gchar *text, gint *screen_value, gint *above_value) +GtkWidget *fullscreen_prefs_selection_new(const gchar *text, gint *screen_value, gboolean *above_value) { GtkWidget *vbox; GtkWidget *hbox; diff -r 7718e351bc45 -r 7e180091e0b7 src/fullscreen.h --- a/src/fullscreen.h Sat Mar 14 10:34:42 2009 +0000 +++ b/src/fullscreen.h Sat Mar 14 11:26:43 2009 +0000 @@ -48,11 +48,11 @@ ScreenData *fullscreen_prefs_list_find(GList *list, gint screen); void fullscreen_prefs_get_geometry(gint screen, GtkWidget *widget, gint *x, gint *y, gint *width, gint *height, - GdkScreen **dest_screen, gint *same_region); + GdkScreen **dest_screen, gboolean *same_region); gint fullscreen_prefs_find_screen_for_widget(GtkWidget *widget); -GtkWidget *fullscreen_prefs_selection_new(const gchar *text, gint *screen_value, gint *above_value); +GtkWidget *fullscreen_prefs_selection_new(const gchar *text, gint *screen_value, gboolean *above_value); #endif diff -r 7718e351bc45 -r 7e180091e0b7 src/histogram.c --- a/src/histogram.c Sat Mar 14 10:34:42 2009 +0000 +++ b/src/histogram.c Sat Mar 14 11:26:43 2009 +0000 @@ -213,7 +213,7 @@ } } -gint histogram_draw(Histogram *histogram, const HistMap *histmap, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height) +gboolean histogram_draw(Histogram *histogram, const HistMap *histmap, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height) { /* FIXME: use the coordinates correctly */ gint i; @@ -222,7 +222,7 @@ gint combine = (HISTMAP_SIZE - 1) / width + 1; gint ypos = y + height; - if (!histogram || !histmap) return 0; + if (!histogram || !histmap) return FALSE; /* Draw the grid */ histogram_vgrid(histogram, pixbuf, x, y, width, height); diff -r 7718e351bc45 -r 7e180091e0b7 src/histogram.h --- a/src/histogram.h Sat Mar 14 10:34:42 2009 +0000 +++ b/src/histogram.h Sat Mar 14 11:26:43 2009 +0000 @@ -32,7 +32,7 @@ gint histogram_toggle_mode(Histogram *histogram); const gchar *histogram_label(Histogram *histogram); const HistMap *histmap_get(FileData *fd); -gint histogram_draw(Histogram *histogram, const HistMap *histmap, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height); +gboolean histogram_draw(Histogram *histogram, const HistMap *histmap, GdkPixbuf *pixbuf, gint x, gint y, gint width, gint height); void histogram_notify_cb(FileData *fd, NotifyType type, gpointer data); diff -r 7718e351bc45 -r 7e180091e0b7 src/history_list.c --- a/src/history_list.c Sat Mar 14 10:34:42 2009 +0000 +++ b/src/history_list.c Sat Mar 14 11:26:43 2009 +0000 @@ -62,7 +62,7 @@ return NULL; } -gint history_list_load(const gchar *path) +gboolean history_list_load(const gchar *path) { FILE *f; gchar *key = NULL; @@ -117,7 +117,7 @@ return TRUE; } -gint history_list_save(const gchar *path) +gboolean history_list_save(const gchar *path) { SecureSaveInfo *ssi; GList *list; diff -r 7718e351bc45 -r 7e180091e0b7 src/history_list.h --- a/src/history_list.h Sat Mar 14 10:34:42 2009 +0000 +++ b/src/history_list.h Sat Mar 14 11:26:43 2009 +0000 @@ -14,8 +14,8 @@ /* history lists */ -gint history_list_load(const gchar *path); -gint history_list_save(const gchar *path); +gboolean history_list_load(const gchar *path); +gboolean history_list_save(const gchar *path); void history_list_free_key(const gchar *key); diff -r 7718e351bc45 -r 7e180091e0b7 src/image.c --- a/src/image.c Sat Mar 14 10:34:42 2009 +0000 +++ b/src/image.c Sat Mar 14 11:26:43 2009 +0000 @@ -101,7 +101,7 @@ image_update_util(imd); } -static void image_complete_util(ImageWindow *imd, gint preload) +static void image_complete_util(ImageWindow *imd, gboolean preload) { if (imd->il && image_get_pixbuf(imd) != image_loader_get_pixbuf(imd->il)) return; @@ -189,7 +189,7 @@ *------------------------------------------------------------------- */ -static gint image_post_process_color(ImageWindow *imd, gint start_row, gint run_in_bg) +static gboolean image_post_process_color(ImageWindow *imd, gint start_row, gboolean run_in_bg) { ColorMan *cm; ColorManProfileType input_type; @@ -629,7 +629,7 @@ /* this read ahead is located here merely for the callbacks, above */ -static gint image_read_ahead_check(ImageWindow *imd) +static gboolean image_read_ahead_check(ImageWindow *imd) { if (!imd->read_ahead_fd) return FALSE; if (imd->il) return FALSE; @@ -676,7 +676,7 @@ return FALSE; } -static gint image_load_begin(ImageWindow *imd, FileData *fd) +static gboolean image_load_begin(ImageWindow *imd, FileData *fd) { DEBUG_1("%s image begin", get_exec_time()); @@ -762,7 +762,7 @@ *------------------------------------------------------------------- */ -static void image_change_complete(ImageWindow *imd, gdouble zoom, gint new) +static void image_change_complete(ImageWindow *imd, gdouble zoom) { image_reset(imd); imd->unknown = TRUE; @@ -814,7 +814,7 @@ imd->image_fd = file_data_ref(fd); - image_change_complete(imd, zoom, TRUE); + image_change_complete(imd, zoom); image_update_title(imd); image_state_set(imd, IMAGE_STATE_IMAGE); @@ -829,7 +829,7 @@ *------------------------------------------------------------------- */ -static void image_focus_paint(ImageWindow *imd, gint has_focus, GdkRectangle *area) +static void image_focus_paint(ImageWindow *imd, gboolean has_focus, GdkRectangle *area) { GtkWidget *widget; @@ -852,7 +852,7 @@ } } -static gint image_focus_expose(GtkWidget *widget, GdkEventExpose *event, gpointer data) +static gboolean image_focus_expose(GtkWidget *widget, GdkEventExpose *event, gpointer data) { ImageWindow *imd = data; @@ -860,7 +860,7 @@ return TRUE; } -static gint image_focus_in_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) +static gboolean image_focus_in_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) { ImageWindow *imd = data; @@ -870,7 +870,7 @@ return TRUE; } -static gint image_focus_out_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) +static gboolean image_focus_out_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data) { ImageWindow *imd = data; @@ -880,7 +880,7 @@ return TRUE; } -static gint image_scroll_cb(GtkWidget *widget, GdkEventScroll *event, gpointer data) +static gboolean image_scroll_cb(GtkWidget *widget, GdkEventScroll *event, gpointer data) { ImageWindow *imd = data; @@ -901,7 +901,7 @@ */ void image_attach_window(ImageWindow *imd, GtkWidget *window, - const gchar *title, const gchar *title_right, gint show_zoom) + const gchar *title, const gchar *title_right, gboolean show_zoom) { imd->top_window = window; g_free(imd->title); @@ -926,7 +926,7 @@ } void image_set_complete_func(ImageWindow *imd, - void (*func)(ImageWindow *imd, gint preload, gpointer data), + void (*func)(ImageWindow *imd, gboolean preload, gpointer data), gpointer data) { imd->func_complete = func; @@ -1018,7 +1018,7 @@ image_change_real(imd, fd, NULL, NULL, zoom); } -gint image_get_image_size(ImageWindow *imd, gint *width, gint *height) +gboolean image_get_image_size(ImageWindow *imd, gint *width, gint *height) { return pixbuf_renderer_get_image_size(PIXBUF_RENDERER(imd->pr), width, height); } @@ -1028,7 +1028,7 @@ return pixbuf_renderer_get_pixbuf((PixbufRenderer *)imd->pr); } -void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom, gint lazy) +void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom, gboolean lazy) { @@ -1209,7 +1209,7 @@ { if (pixbuf_renderer_get_tiles((PixbufRenderer *)imd->pr)) return; - image_change_complete(imd, image_zoom_get(imd), FALSE); + image_change_complete(imd, image_zoom_get(imd)); } void image_scroll(ImageWindow *imd, gint x, gint y) @@ -1396,7 +1396,7 @@ imd->auto_refresh = enable; } -void image_top_window_set_sync(ImageWindow *imd, gint allow_sync) +void image_top_window_set_sync(ImageWindow *imd, gboolean allow_sync) { imd->top_window_sync = allow_sync; @@ -1410,7 +1410,7 @@ void image_color_profile_set(ImageWindow *imd, gint input_type, gint screen_type, - gint use_image) + gboolean use_image) { if (!imd) return; @@ -1425,9 +1425,9 @@ imd->color_profile_use_image = use_image; } -gint image_color_profile_get(ImageWindow *imd, - gint *input_type, gint *screen_type, - gint *use_image) +gboolean image_color_profile_get(ImageWindow *imd, + gint *input_type, gint *screen_type, + gboolean *use_image) { if (!imd) return FALSE; @@ -1438,7 +1438,7 @@ return TRUE; } -void image_color_profile_set_use(ImageWindow *imd, gint enable) +void image_color_profile_set_use(ImageWindow *imd, gboolean enable) { if (!imd) return; @@ -1447,7 +1447,7 @@ imd->color_profile_enable = enable; } -gint image_color_profile_get_use(ImageWindow *imd) +gboolean image_color_profile_get_use(ImageWindow *imd) { if (!imd) return FALSE; @@ -1456,12 +1456,12 @@ gint image_color_profile_get_from_image(ImageWindow *imd) { - if (!imd) return FALSE; + if (!imd) return COLOR_PROFILE_NONE; return imd->color_profile_from_image; } -void image_set_delay_flip(ImageWindow *imd, gint delay) +void image_set_delay_flip(ImageWindow *imd, gboolean delay) { if (!imd || imd->delay_flip == delay) return; @@ -1482,7 +1482,7 @@ } } -void image_to_root_window(ImageWindow *imd, gint scaled) +void image_to_root_window(ImageWindow *imd, gboolean scaled) { GdkScreen *screen; GdkWindow *rootwindow; @@ -1705,7 +1705,7 @@ imd->has_frame = frame; } -ImageWindow *image_new(gint frame) +ImageWindow *image_new(gboolean frame) { ImageWindow *imd; diff -r 7718e351bc45 -r 7e180091e0b7 src/image.h --- a/src/image.h Sat Mar 14 10:34:42 2009 +0000 +++ b/src/image.h Sat Mar 14 11:26:43 2009 +0000 @@ -16,11 +16,11 @@ void image_set_frame(ImageWindow *imd, gboolean frame); -ImageWindow *image_new(gint frame); +ImageWindow *image_new(gboolean frame); /* additional setup */ void image_attach_window(ImageWindow *imd, GtkWidget *window, - const gchar *title, const gchar *title_right, gint show_zoom); + const gchar *title, const gchar *title_right, gboolean show_zoom); void image_set_update_func(ImageWindow *imd, void (*func)(ImageWindow *imd, gpointer data), gpointer data); @@ -56,12 +56,12 @@ /* load a new image */ void image_change_fd(ImageWindow *imd, FileData *fd, gdouble zoom); -void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom, gint lazy); +void image_change_pixbuf(ImageWindow *imd, GdkPixbuf *pixbuf, gdouble zoom, gboolean lazy); void image_change_from_collection(ImageWindow *imd, CollectionData *cd, CollectInfo *info, gdouble zoom); CollectionData *image_get_collection(ImageWindow *imd, CollectInfo **info); void image_change_from_image(ImageWindow *imd, ImageWindow *source); -gint image_get_image_size(ImageWindow *imd, gint *width, gint *height); +gboolean image_get_image_size(ImageWindow *imd, gint *width, gint *height); GdkPixbuf *image_get_pixbuf(ImageWindow *imd); /* manipulation */ @@ -92,7 +92,7 @@ void image_auto_refresh_enable(ImageWindow *imd, gboolean enable); /* allow top window to be resized ? */ -void image_top_window_set_sync(ImageWindow *imd, gint allow_sync); +void image_top_window_set_sync(ImageWindow *imd, gboolean allow_sync); /* background of image */ void image_background_set_color(ImageWindow *imd, GdkColor *color); @@ -100,19 +100,19 @@ /* color profiles */ void image_color_profile_set(ImageWindow *imd, gint input_type, gint screen_type, - gint use_embedded); -gint image_color_profile_get(ImageWindow *imd, + gboolean use_image); +gboolean image_color_profile_get(ImageWindow *imd, gint *input_type, gint *screen_type, - gint *use_image); -void image_color_profile_set_use(ImageWindow *imd, gint enable); -gint image_color_profile_get_use(ImageWindow *imd); + gboolean *use_image); +void image_color_profile_set_use(ImageWindow *imd, gboolean enable); +gboolean image_color_profile_get_use(ImageWindow *imd); gint image_color_profile_get_from_image(ImageWindow *imd); /* set delayed page flipping */ void image_set_delay_flip(ImageWindow *imd, gint delay); /* wallpaper util */ -void image_to_root_window(ImageWindow *imd, gint scaled); +void image_to_root_window(ImageWindow *imd, gboolean scaled); diff -r 7718e351bc45 -r 7e180091e0b7 src/layout.c --- a/src/layout.c Sat Mar 14 10:34:42 2009 +0000 +++ b/src/layout.c Sat Mar 14 11:26:43 2009 +0000 @@ -348,7 +348,8 @@ static void layout_color_menu_use_image_cb(GtkWidget *widget, gpointer data) { LayoutWindow *lw = data; - gint input, screen, use_image; + gint input, screen; + gboolean use_image; if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return; layout_image_color_profile_set(lw, input, screen, !use_image); @@ -361,7 +362,8 @@ { LayoutWindow *lw = data; gint type; - gint input, screen, use_image; + gint input, screen; + gboolean use_image; if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; @@ -379,7 +381,8 @@ { LayoutWindow *lw = data; gint type; - gint input, screen, use_image; + gint input, screen; + gboolean use_image; if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return; @@ -418,8 +421,8 @@ gboolean active; gint input = 0; gint screen = 0; - gint use_image = 0; - gboolean from_image = FALSE; + gboolean use_image = FALSE; + gboolean from_image; gint image_profile; gint i; diff -r 7718e351bc45 -r 7e180091e0b7 src/layout_image.c --- a/src/layout_image.c Sat Mar 14 10:34:42 2009 +0000 +++ b/src/layout_image.c Sat Mar 14 11:26:43 2009 +0000 @@ -14,6 +14,7 @@ #include "layout_image.h" #include "collect.h" +#include "color-man.h" #include "dnd.h" #include "editors.h" #include "filedata.h" @@ -1062,23 +1063,23 @@ void layout_image_color_profile_set(LayoutWindow *lw, gint input_type, gint screen_type, - gint use_image) + gboolean use_image) { if (!layout_valid(&lw)) return; image_color_profile_set(lw->image, input_type, screen_type, use_image); } -gint layout_image_color_profile_get(LayoutWindow *lw, - gint *input_type, gint *screen_type, - gint *use_image) +gboolean layout_image_color_profile_get(LayoutWindow *lw, + gint *input_type, gint *screen_type, + gboolean *use_image) { if (!layout_valid(&lw)) return FALSE; return image_color_profile_get(lw->image, input_type, screen_type, use_image); } -void layout_image_color_profile_set_use(LayoutWindow *lw, gint enable) +void layout_image_color_profile_set_use(LayoutWindow *lw, gboolean enable) { if (!layout_valid(&lw)) return; @@ -1093,7 +1094,7 @@ } } -gint layout_image_color_profile_get_use(LayoutWindow *lw) +gboolean layout_image_color_profile_get_use(LayoutWindow *lw) { if (!layout_valid(&lw)) return FALSE; @@ -1102,7 +1103,7 @@ gint layout_image_color_profile_get_from_image(LayoutWindow *lw) { - if (!layout_valid(&lw)) return FALSE; + if (!layout_valid(&lw)) return COLOR_PROFILE_NONE; return image_color_profile_get_from_image(lw->image); } diff -r 7718e351bc45 -r 7e180091e0b7 src/layout_image.h --- a/src/layout_image.h Sat Mar 14 10:34:42 2009 +0000 +++ b/src/layout_image.h Sat Mar 14 11:26:43 2009 +0000 @@ -30,12 +30,12 @@ void layout_image_color_profile_set(LayoutWindow *lw, gint input_type, gint screen_type, - gint use_image); -gint layout_image_color_profile_get(LayoutWindow *lw, + gboolean use_image); +gboolean layout_image_color_profile_get(LayoutWindow *lw, gint *input_type, gint *screen_type, - gint *use_image); + gboolean *use_image); void layout_image_color_profile_set_use(LayoutWindow *lw, gint enable); -gint layout_image_color_profile_get_use(LayoutWindow *lw); +gboolean layout_image_color_profile_get_use(LayoutWindow *lw); gint layout_image_color_profile_get_from_image(LayoutWindow *lw); diff -r 7718e351bc45 -r 7e180091e0b7 src/pixbuf-renderer.c --- a/src/pixbuf-renderer.c Sat Mar 14 10:34:42 2009 +0000 +++ b/src/pixbuf-renderer.c Sat Mar 14 11:26:43 2009 +0000 @@ -4212,7 +4212,7 @@ return TRUE; } -gint pixbuf_renderer_get_image_size(PixbufRenderer *pr, gint *width, gint *height) +gboolean pixbuf_renderer_get_image_size(PixbufRenderer *pr, gint *width, gint *height) { g_return_val_if_fail(IS_PIXBUF_RENDERER(pr), FALSE); g_return_val_if_fail(width != NULL && height != NULL, FALSE); diff -r 7718e351bc45 -r 7e180091e0b7 src/pixbuf-renderer.h --- a/src/pixbuf-renderer.h Sat Mar 14 10:34:42 2009 +0000 +++ b/src/pixbuf-renderer.h Sat Mar 14 11:26:43 2009 +0000 @@ -235,7 +235,7 @@ /* sizes */ -gint pixbuf_renderer_get_image_size(PixbufRenderer *pr, gint *width, gint *height); +gboolean pixbuf_renderer_get_image_size(PixbufRenderer *pr, gint *width, gint *height); gint pixbuf_renderer_get_scaled_size(PixbufRenderer *pr, gint *width, gint *height); /* region of image in pixel coordinates */ diff -r 7718e351bc45 -r 7e180091e0b7 src/typedefs.h --- a/src/typedefs.h Sat Mar 14 10:34:42 2009 +0000 +++ b/src/typedefs.h Sat Mar 14 11:26:43 2009 +0000 @@ -357,21 +357,21 @@ FileData *image_fd; - gint unknown; /* failed to load image */ + gboolean unknown; /* failed to load image */ ImageLoader *il; /* FIXME - image loader should probably go to FileData, but it must first support sending callbacks to multiple ImageWindows in parallel */ - gint has_frame; + gint has_frame; /* not boolean, see image_new() */ /* top level (not necessarily parent) window */ - gint top_window_sync; /* resize top_window when image dimensions change */ + gboolean top_window_sync; /* resize top_window when image dimensions change */ GtkWidget *top_window; /* window that gets title, and window to resize when 'fitting' */ gchar *title; /* window title to display left of file name */ gchar *title_right; /* window title to display right of file name */ - gint title_show_zoom; /* option to include zoom in window title */ + gboolean title_show_zoom; /* option to include zoom in window title */ - gint completed; + gboolean completed; ImageState state; /* mask of IMAGE_STATE_* flags about current image */ void (*func_update)(ImageWindow *imd, gpointer data); @@ -404,10 +404,10 @@ CollectInfo *collection_info; /* color profiles */ - gint color_profile_enable; + gboolean color_profile_enable; gint color_profile_input; gint color_profile_screen; - gint color_profile_use_image; + gboolean color_profile_use_image; gint color_profile_from_image; gpointer cm; @@ -418,13 +418,13 @@ gint prev_color_row; - gint auto_refresh; + gboolean auto_refresh; - gint delay_flip; + gboolean delay_flip; gint orientation; - gint desaturate; + gboolean desaturate; - gint overlay_show_zoom; /* set to true if overlay is showing zoom ratio */ + gboolean overlay_show_zoom; /* set to true if overlay is showing zoom ratio */ }; #define FILEDATA_MARKS_SIZE 6