GdkPixbuf *pixbuf;
FileData *fd;
gboolean need_update;
- gint idle_id;
+ guint idle_id; /* event source id */
};
static gboolean bar_pane_histogram_update_cb(gpointer data);
FIXME: this does not work for fullscreen*/
if (GTK_WIDGET_DRAWABLE(phd->drawing_area))
{
- if (phd->idle_id == -1) phd->idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, bar_pane_histogram_update_cb, phd, NULL);
+ if (!phd->idle_id)
+ {
+ phd->idle_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, bar_pane_histogram_update_cb, phd, NULL);
+ }
}
else
{
const HistMap *histmap;
PaneHistogramData *phd = data;
- phd->idle_id = -1;
+ phd->idle_id = 0;
phd->need_update = FALSE;
gtk_widget_queue_draw_area(GTK_WIDGET(phd->drawing_area), 0, 0, phd->histogram_width, phd->histogram_height);
{
PaneHistogramData *phd = data;
- g_source_remove(phd->idle_id);
+ if (phd->idle_id) g_source_remove(phd->idle_id);
file_data_unregister_notify_func(bar_pane_histogram_notify_cb, phd);
file_data_unref(phd->fd);
phd->pane.type = PANE_HISTOGRAM;
phd->pane.expanded = expanded;
- phd->idle_id = -1;
phd->histogram = histogram_new();
gboolean collapse_unchecked;
gboolean hide_unchecked;
- gint idle_id;
+ guint idle_id; /* event source id */
FileData *fd;
gchar *key;
};
bar_pane_keywords_write(pkd);
bar_keyword_tree_sync(pkd);
file_data_register_notify_func(bar_pane_keywords_notify_cb, pkd, NOTIFY_PRIORITY_LOW);
- pkd->idle_id = -1;
+ pkd->idle_id = 0;
return FALSE;
}
{
PaneKeywordsData *pkd = data;
- if (pkd->idle_id != -1) return;
+ if (pkd->idle_id) return;
/* higher prio than redraw */
pkd->idle_id = g_idle_add_full(G_PRIORITY_HIGH_IDLE, bar_pane_keywords_changed_idle_cb, pkd, NULL);
}
PaneKeywordsData *pkd = data;
if (pkd->click_tpath) gtk_tree_path_free(pkd->click_tpath);
- if (pkd->idle_id != -1) g_source_remove(pkd->idle_id);
+ if (pkd->idle_id) g_source_remove(pkd->idle_id);
file_data_unregister_notify_func(bar_pane_keywords_notify_cb, pkd);
file_data_unref(pkd->fd);
pkd->expand_checked = TRUE;
- pkd->idle_id = -1;
-
hbox = gtk_hbox_new(FALSE, PREF_PAD_GAP);
pkd->widget = hbox;
g_free(base);
}
- cl->idle_id = -1;
+ cl->idle_id = 0;
if (cl->done_func)
{
{
if (!cl) return;
- if (cl->idle_id != -1)
+ if (cl->idle_id)
{
g_source_remove(cl->idle_id);
- cl->idle_id = -1;
+ cl->idle_id = 0;
}
image_loader_free(cl->il);
gboolean error;
ImageLoader *il;
- gint idle_id;
+ guint idle_id; /* event source id */
};
{
GList *list;
GList *done_list;
- gint idle_id;
+ guint idle_id; /* event source id */
GenericDialog *gd;
GtkWidget *entry;
GtkWidget *spinner;
static void cache_maintain_home_close(CMData *cm)
{
- if (cm->idle_id != -1) g_source_remove(cm->idle_id);
+ if (cm->idle_id) g_source_remove(cm->idle_id);
if (cm->gd) generic_dialog_close(cm->gd);
filelist_free(cm->list);
g_list_free(cm->done_list);
static void cache_maintain_home_stop(CMData *cm)
{
- if (cm->idle_id != -1)
+ if (cm->idle_id)
{
g_source_remove(cm->idle_id);
- cm->idle_id = -1;
+ cm->idle_id = 0;
}
gtk_entry_set_text(GTK_ENTRY(cm->entry), _("done"));
if (!cm->list)
{
DEBUG_1("purge chk done.");
- cm->idle_id = -1;
+ cm->idle_id = 0;
cache_maintain_home_stop(cm);
return FALSE;
}
gboolean local;
gboolean recurse;
- gint idle_id;
+ guint idle_id; /* event source id */
};
static void cache_manager_render_reset(CleanData *cd)
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(cd->progress), 1.0);
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(cd->progress), _("done"));
- if (cd->idle_id != -1)
+ if (cd->idle_id)
{
g_source_remove(cd->idle_id);
- cd->idle_id = -1;
+ cd->idle_id = 0;
}
thumb_loader_std_thumb_file_validate_cancel(cd->tl);
return TRUE;
}
- cd->idle_id = -1;
+ cd->idle_id = 0;
cache_manager_standard_clean_done(cd);
return FALSE;
}
cd->days = 30;
cd->tl = NULL;
- cd->idle_id = -1;
+ cd->idle_id = 0;
gtk_widget_show(cd->gd->dialog);
}
static GList *collection_manager_entry_list = NULL;
static GList *collection_manager_action_list = NULL;
static GList *collection_manager_action_tail = NULL;
-static gint collection_manager_timer_id = -1;
+static guint collection_manager_timer_id = 0; /* event source id */
static CollectManagerAction *collect_manager_action_new(const gchar *oldpath, const gchar *newpath,
g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL);
- collection_manager_timer_id = -1;
+ collection_manager_timer_id = 0;
return FALSE;
}
static void collect_manager_timer_push(gint stop)
{
- if (collection_manager_timer_id != -1)
+ if (collection_manager_timer_id)
{
if (!stop) return;
g_source_remove(collection_manager_timer_id);
- collection_manager_timer_id = -1;
+ collection_manager_timer_id = 0;
}
if (!stop)
{
CollectTable *ct = data;
- if (ct->tip_delay_id == -1) return FALSE;
+ if (!ct->tip_delay_id) return FALSE;
tip_show(ct);
- ct->tip_delay_id = -1;
+ ct->tip_delay_id = 0;
return FALSE;
}
{
tip_hide(ct);
- if (ct->tip_delay_id != -1)
+ if (ct->tip_delay_id)
{
g_source_remove(ct->tip_delay_id);
- ct->tip_delay_id = -1;
+ ct->tip_delay_id = 0;
}
ct->tip_delay_id = g_timeout_add(ct->show_text ? COLLECT_TABLE_TIP_DELAY_PATH : COLLECT_TABLE_TIP_DELAY, tip_schedule_cb, ct);
{
tip_hide(ct);
- if (ct->tip_delay_id != -1) g_source_remove(ct->tip_delay_id);
- ct->tip_delay_id = -1;
+ if (ct->tip_delay_id)
+ {
+ g_source_remove(ct->tip_delay_id);
+ ct->tip_delay_id = 0;
+ }
}
static void tip_update(CollectTable *ct, CollectInfo *info)
gint x, y;
gint w, h;
- if (ct->drop_idle_id == -1) return FALSE;
+ if (!ct->drop_idle_id) return FALSE;
window = ct->listview->window;
gdk_window_get_pointer(window, &x, &y, NULL);
collection_table_motion_update(ct, x, y, TRUE);
}
- ct->drop_idle_id = -1;
+ ct->drop_idle_id = 0;
return FALSE;
}
{
CollectTable *ct = data;
- if (ct->drop_idle_id == -1) ct->drop_idle_id = g_idle_add(collection_table_auto_scroll_idle_cb, ct);
+ if (!ct->drop_idle_id)
+ {
+ ct->drop_idle_id = g_idle_add(collection_table_auto_scroll_idle_cb, ct);
+ }
return TRUE;
}
{
if (!scroll)
{
- if (ct->drop_idle_id != -1)
+ if (ct->drop_idle_id)
{
g_source_remove(ct->drop_idle_id);
- ct->drop_idle_id = -1;
+ ct->drop_idle_id = 0;
}
widget_auto_scroll_stop(ct->listview);
collection_table_insert_marker(ct, NULL, FALSE);
{
CollectTable *ct = data;
- if (ct->sync_idle_id == -1) return FALSE;
- ct->sync_idle_id = -1;
+ if (!ct->sync_idle_id) return FALSE;
+ g_source_remove(ct->sync_idle_id);
+ ct->sync_idle_id = 0;
collection_table_sync(ct);
return FALSE;
static void collection_table_sync_idle(CollectTable *ct)
{
- if (ct->sync_idle_id == -1)
+ if (!ct->sync_idle_id)
{
/* high priority, the view needs to be resynced before a redraw
* may contain invalid pointers at this time
gtk_widget_destroy(ct->popup);
}
- if (ct->sync_idle_id != -1) g_source_remove(ct->sync_idle_id);
+ if (ct->sync_idle_id) g_source_remove(ct->sync_idle_id);
tip_unschedule(ct);
collection_table_scroll(ct, FALSE);
ct = g_new0(CollectTable, 1);
ct->cd = cd;
- ct->tip_delay_id = -1;
ct->show_text = options->show_icon_names;
- ct->sync_idle_id = -1;
- ct->drop_idle_id = -1;
-
ct->scrolled = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ct->scrolled), GTK_SHADOW_IN);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ct->scrolled),
if (cm->imd &&
cm->pixbuf != image_get_pixbuf(cm->imd))
{
- cm->idle_id = -1;
+ cm->idle_id = 0;
color_man_done(cm, COLOR_RETURN_IMAGE_CHANGED);
return FALSE;
}
image_area_changed(cm->imd, 0, 0, width, height);
}
- cm->idle_id = -1;
+ cm->idle_id = 0;
color_man_done(cm, COLOR_RETURN_SUCCESS);
return FALSE;
}
cm->pixbuf = pixbuf;
if (cm->pixbuf) g_object_ref(cm->pixbuf);
- cm->incremental_sync = FALSE;
- cm->row = 0;
- cm->idle_id = -1;
-
has_alpha = pixbuf ? gdk_pixbuf_get_has_alpha(pixbuf) : FALSE;
cm->profile = color_man_cache_get(input_type, input_file, input_data, input_data_len,
{
if (!cm) return;
- if (cm->idle_id != -1) g_source_remove(cm->idle_id);
+ if (cm->idle_id) g_source_remove(cm->idle_id);
if (cm->pixbuf) g_object_unref(cm->pixbuf);
color_man_cache_unref(cm->profile);
gpointer profile;
- gint idle_id;
+ guint idle_id; /* event source id */
ColorManDoneFunc func_done;
gpointer func_done_data;
static void dupe_check_stop(DupeWindow *dw)
{
- if (dw->idle_id != -1 || dw->img_loader || dw->thumb_loader)
+ if (dw->idle_id || dw->img_loader || dw->thumb_loader)
{
g_source_remove(dw->idle_id);
- dw->idle_id = -1;
+ dw->idle_id = 0;
dupe_window_update_progress(dw, NULL, 0.0, FALSE);
widget_set_cursor(dw->listview, -1);
}
{
DupeWindow *dw = data;
- if (dw->idle_id == -1) return FALSE;
+ if (!dw->idle_id) return FALSE;
if (!dw->setup_done)
{
dw->img_loader = NULL;
return TRUE;
}
- dw->idle_id = -1;
+ dw->idle_id = 0;
return FALSE;
}
dupe_window_update_progress(dw, _("Sorting..."), 1.0, TRUE);
return TRUE;
}
- dw->idle_id = -1;
+ dw->idle_id = 0;
dupe_window_update_progress(dw, NULL, 0.0, FALSE);
dupe_match_rank(dw);
dupe_window_update_count(dw, TRUE);
widget_set_cursor(dw->listview, GDK_WATCH);
- if (dw->idle_id != -1) return;
+ if (dw->idle_id) return;
dw->idle_id = g_idle_add(dupe_check_cb, dw);
}
dw = g_new0(DupeWindow, 1);
- dw->list = NULL;
- dw->dupes = NULL;
dw->match_mask = match_mask;
- dw->show_thumbs = FALSE;
-
- dw->idle_id = -1;
-
- dw->second_set = FALSE;
dw->window = window_new(GTK_WINDOW_TOPLEVEL, "dupe", NULL, NULL, _("Find duplicates"));
gboolean show_thumbs;
- gint idle_id;
+ guint idle_id; /* event source id */
GList *working;
gint setup_done;
gint setup_count;
}
static GHashTable *file_data_monitor_pool = NULL;
-static gint realtime_monitor_id = -1;
+static guint realtime_monitor_id = 0; /* event source id */
static void realtime_monitor_check_cb(gpointer key, gpointer value, gpointer data)
{
count++;
g_hash_table_insert(file_data_monitor_pool, fd, GINT_TO_POINTER(count));
- if (realtime_monitor_id == -1)
+ if (!realtime_monitor_id)
{
realtime_monitor_id = g_timeout_add(5000, realtime_monitor_cb, NULL);
}
if (g_hash_table_size(file_data_monitor_pool) == 0)
{
g_source_remove(realtime_monitor_id);
- realtime_monitor_id = -1;
+ realtime_monitor_id = 0;
return FALSE;
}
{
FullScreenData *fs = data;
- if (fs->hide_mouse_id == -1) return FALSE;
+ if (!fs->hide_mouse_id) return FALSE;
fs->cursor_state &= ~FULLSCREEN_CURSOR_NORMAL;
if (!(fs->cursor_state & FULLSCREEN_CURSOR_BUSY)) clear_mouse_cursor(fs->window, fs->cursor_state);
- fs->hide_mouse_id = -1;
+ g_source_remove(fs->hide_mouse_id);
+ fs->hide_mouse_id = 0;
return FALSE;
}
static void fullscreen_hide_mouse_disable(FullScreenData *fs)
{
- if (fs->hide_mouse_id != -1)
+ if (fs->hide_mouse_id)
{
g_source_remove(fs->hide_mouse_id);
- fs->hide_mouse_id = -1;
+ fs->hide_mouse_id = 0;
}
}
static void fullscreen_busy_mouse_disable(FullScreenData *fs)
{
- if (fs->busy_mouse_id != -1)
+ if (fs->busy_mouse_id)
{
g_source_remove(fs->busy_mouse_id);
- fs->busy_mouse_id = -1;
+ fs->busy_mouse_id = 0;
}
}
{
FullScreenData *fs = data;
- fs->busy_mouse_id = -1;
+ fs->busy_mouse_id = 0;
fullscreen_mouse_set_busy(fs, TRUE);
return FALSE;
}
static void fullscreen_mouse_set_busy_idle(FullScreenData *fs)
{
- if (fs->busy_mouse_id == -1)
+ if (!fs->busy_mouse_id)
{
fs->busy_mouse_id = g_timeout_add(FULL_SCREEN_BUSY_MOUSE_DELAY,
fullscreen_mouse_set_busy_cb, fs);
fs = g_new0(FullScreenData, 1);
- fs->hide_mouse_id = -1;
- fs->busy_mouse_id = -1;
fs->cursor_state = FULLSCREEN_CURSOR_HIDDEN;
fs->normal_window = window;
{
if (!fs) return;
- g_source_remove(fs->saver_block_id);
+ if (fs->saver_block_id) g_source_remove(fs->saver_block_id);
fullscreen_hide_mouse_disable(fs);
fullscreen_busy_mouse_disable(fs);
gulong b[HISTMAP_SIZE];
gulong max[HISTMAP_SIZE];
- gint idle_id;
+ guint idle_id; /* event source id */
GdkPixbuf *pixbuf;
gint y;
};
static HistMap *histmap_new(void)
{
HistMap *histmap = g_new0(HistMap, 1);
- histmap->idle_id = -1;
return histmap;
}
void histmap_free(HistMap *histmap)
{
if (!histmap) return;
- if (histmap->idle_id != -1) g_source_remove(histmap->idle_id);
+ if (histmap->idle_id) g_source_remove(histmap->idle_id);
if (histmap->pixbuf) g_object_unref(histmap->pixbuf);
g_free(histmap);
}
const HistMap *histmap_get(FileData *fd)
{
- if (fd->histmap && fd->histmap->idle_id == -1) return fd->histmap; /* histmap exists and is finished */
+ if (fd->histmap && !fd->histmap->idle_id) return fd->histmap; /* histmap exists and is finished */
return NULL;
}
/* finished */
g_object_unref(fd->histmap->pixbuf); /*pixbuf is no longer needed */
fd->histmap->pixbuf = NULL;
- fd->histmap->idle_id = -1;
+ fd->histmap->idle_id = 0;
file_data_send_notification(fd, NOTIFY_HISTMAP);
return FALSE;
}
ImageLoader *il = (ImageLoader *)instance;
il->pixbuf = NULL;
- il->idle_id = -1;
+ il->idle_id = 0;
il->idle_priority = G_PRIORITY_DEFAULT_IDLE;
il->done = FALSE;
il->loader = NULL;
il->bytes_read = 0;
il->bytes_total = 0;
- il->idle_done_id = -1;
+ il->idle_done_id = 0;
il->idle_read_loop_count = IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT;
il->read_buffer_size = IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT;
DEBUG_1("freeing image loader %p bytes_read=%d", il, il->bytes_read);
- if (il->idle_done_id != -1) g_source_remove(il->idle_done_id);
+ if (il->idle_done_id)
+ {
+ g_source_remove(il->idle_done_id);
+ il->idle_done_id = 0;
+ }
while (g_source_remove_by_user_data(il))
{
{
if (!il) return;
- if (il->idle_id != -1)
+ if (il->idle_id)
{
g_source_remove(il->idle_id);
- il->idle_id = -1;
+ il->idle_id = 0;
}
if (il->thread)
gboolean ret = FALSE;
ImageLoader *il = data;
- if (il->idle_id != -1)
+ if (il->idle_id)
{
ret = image_loader_continue(il);
}
gboolean shrunk;
gboolean done;
- gint idle_id;
+ guint idle_id; /* event source id */
gint idle_priority;
GdkPixbufLoader *loader;
GError *error;
- gint idle_done_id;
+ guint idle_done_id; /* event source id */
GList *area_param_list;
GList *area_param_delayed_list;
gint icon_time[IMAGE_OSD_COUNT];
gint icon_id[IMAGE_OSD_COUNT];
- gint idle_id;
- gint timer_id;
+ guint idle_id; /* event source id */
+ guint timer_id; /* event source id */
gulong destroy_id;
};
osd->changed_states = IMAGE_STATE_NONE;
osd->notify = 0;
- osd->idle_id = -1;
+ osd->idle_id = 0;
return FALSE;
}
{
if (force) osd->changed_states |= IMAGE_STATE_IMAGE;
- if (osd->idle_id == -1)
+ if (!osd->idle_id)
{
osd->idle_id = g_idle_add_full(G_PRIORITY_HIGH, image_osd_update_cb, osd, NULL);
}
if (done)
{
- osd->timer_id = -1;
+ osd->timer_id = 0;
return FALSE;
}
static void image_osd_timer_schedule(OverlayStateData *osd)
{
- if (osd->timer_id == -1)
+ if (!osd->timer_id)
{
osd->timer_id = g_timeout_add(100, image_osd_timer_cb, osd);
}
{
if (!osd) return;
- if (osd->idle_id != -1) g_source_remove(osd->idle_id);
- if (osd->timer_id != -1) g_source_remove(osd->timer_id);
+ if (osd->idle_id) g_source_remove(osd->idle_id);
+ if (osd->timer_id) g_source_remove(osd->timer_id);
file_data_unregister_notify_func(image_osd_notify_cb, osd);
{
osd = g_new0(OverlayStateData, 1);
osd->imd = imd;
- osd->idle_id = -1;
- osd->timer_id = -1;
osd->show = OSD_SHOW_NOTHING;
osd->x = options->image_overlay.x;
osd->y = options->image_overlay.y;
gint lirc_fd = -1;
struct lirc_config *config = NULL;
-guint input_tag;
+guint input_tag = 0; /* event source id */
GIOChannel *gio_chan;
/*
*/
static GList *metadata_write_queue = NULL;
-static gint metadata_write_idle_id = -1;
+static guint metadata_write_idle_id = 0; /* event source id */
static void metadata_write_queue_add(FileData *fd)
{
layout_status_update_write_all();
}
- if (metadata_write_idle_id != -1)
+ if (metadata_write_idle_id)
{
g_source_remove(metadata_write_idle_id);
- metadata_write_idle_id = -1;
+ metadata_write_idle_id = 0;
}
if (options->metadata.confirm_after_timeout)
static gboolean metadata_write_queue_idle_cb(gpointer data)
{
metadata_write_queue_confirm(NULL, NULL);
- metadata_write_idle_id = -1;
+ metadata_write_idle_id = 0;
return FALSE;
}
GtkWidget *scrollbar_h;
GtkWidget *scrollbar_v;
- gint overlay_id;
-
FileData *dir_fd;
PanLayoutType layout;
PanImageSize size;
if (pan_cache_step(pw)) return TRUE;
- pw->idle_id = -1;
+ pw->idle_id = 0;
return FALSE;
}
}
pan_window_message(pw, NULL);
- pw->idle_id = -1;
+ pw->idle_id = 0;
return FALSE;
}
static void pan_layout_update_idle(PanWindow *pw)
{
- if (pw->idle_id == -1)
+ if (!pw->idle_id)
{
pw->idle_id = g_idle_add(pan_layout_update_idle_cb, pw);
}
pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_INFO_IMAGE, pw->info_image_size);
pref_list_int_set(PAN_PREF_GROUP, PAN_PREF_INFO_EXIF, pw->info_includes_exif);
- if (pw->idle_id != -1)
+ if (pw->idle_id)
{
g_source_remove(pw->idle_id);
}
pw->ignore_symlinks = TRUE;
- pw->overlay_id = -1;
- pw->idle_id = -1;
+ pw->idle_id = 0;
pw->window = window_new(GTK_WINDOW_TOPLEVEL, "panview", NULL, NULL, _("Pan View"));
pr->scroll_reset = PR_SCROLL_RESET_TOPLEFT;
- pr->draw_idle_id = -1;
+ pr->draw_idle_id = 0;
pr->tile_width = PR_TILE_SIZE;
pr->tile_height = PR_TILE_SIZE;
pr->tile_cache_max = PR_CACHE_SIZE_DEFAULT;
- pr->scroller_id = -1;
+ pr->scroller_id = 0;
pr->scroller_overlay = -1;
pr->x_mouse = -1;
static void pr_scroller_timer_set(PixbufRenderer *pr, gboolean start)
{
- if (pr->scroller_id != -1)
+ if (pr->scroller_id)
{
g_source_remove(pr->scroller_id);
- pr->scroller_id = -1;
+ pr->scroller_id = 0;
}
if (start)
static void pr_scroller_stop(PixbufRenderer *pr)
{
- if (pr->scroller_id == -1) return;
+ if (!pr->scroller_id) return;
pixbuf_renderer_overlay_remove(pr, pr->scroller_overlay);
pr->scroller_overlay = -1;
if ((!pr->pixbuf && !pr->source_tiles_enabled) ||
(!pr->draw_queue && !pr->draw_queue_2pass) ||
- pr->draw_idle_id == -1)
+ !pr->draw_idle_id)
{
pr_render_complete_signal(pr);
- pr->draw_idle_id = -1;
+ pr->draw_idle_id = 0;
return FALSE;
}
{
pr_render_complete_signal(pr);
- pr->draw_idle_id = -1;
+ pr->draw_idle_id = 0;
return FALSE;
}
pr_queue_list_free(pr->draw_queue_2pass);
pr->draw_queue_2pass = NULL;
- if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
- pr->draw_idle_id = -1;
+ if (pr->draw_idle_id)
+ {
+ g_source_remove(pr->draw_idle_id);
+ pr->draw_idle_id = 0;
+ }
}
static void pr_queue_merge(QueueData *parent, QueueData *qd)
if (w < 1 || h < 1) return;
if (pr_queue_to_tiles(pr, nx, ny, w, h, clamp, render, new_data, only_existing) &&
- ((!pr->draw_queue && !pr->draw_queue_2pass) || pr->draw_idle_id == -1))
+ ((!pr->draw_queue && !pr->draw_queue_2pass) || !pr->draw_idle_id))
{
- if (pr->draw_idle_id != -1) g_source_remove(pr->draw_idle_id);
+ if (pr->draw_idle_id)
+ {
+ g_source_remove(pr->draw_idle_id);
+ pr->draw_idle_id = 0;
+ }
pr_queue_schedule_next_draw(pr, TRUE);
}
}
pr = PIXBUF_RENDERER(widget);
- if (pr->scroller_id != -1)
+ if (pr->scroller_id)
{
pr->scroller_xpos = bevent->x;
pr->scroller_ypos = bevent->y;
pr = PIXBUF_RENDERER(widget);
- if (pr->scroller_id != -1) return TRUE;
+ if (pr->scroller_id) return TRUE;
switch (bevent->button)
{
pr = PIXBUF_RENDERER(widget);
- if (pr->scroller_id != -1)
+ if (pr->scroller_id)
{
pr_scroller_stop(pr);
return TRUE;
pr = PIXBUF_RENDERER(widget);
- if (pr->scroller_id != -1)
+ if (pr->scroller_id)
{
pr->scroller_xpos = pr->scroller_x;
pr->scroller_ypos = pr->scroller_y;
GList *draw_queue; /* list of areas to redraw */
GList *draw_queue_2pass;/* list when 2 pass is enabled */
- gint draw_idle_id;
+ guint draw_idle_id; /* event source id */
gboolean in_drag;
gint drag_last_x;
gboolean complete;
gboolean debug_updated; /* debug only */
- gint scroller_id;
+ guint scroller_id; /* event source id */
gint scroller_overlay;
gint scroller_x;
gint scroller_y;
gdouble layout_width;
gdouble layout_height;
- gint layout_idle_id;
+ guint layout_idle_id; /* event source id */
gdouble image_scale;
static void print_window_layout_render_stop(PrintWindow *pw)
{
- if (pw->layout_idle_id != -1)
+ if (pw->layout_idle_id)
{
g_source_remove(pw->layout_idle_id);
- pw->layout_idle_id = -1;
+ pw->layout_idle_id = 0;
}
}
print_job_close(pw, FALSE);
print_job_start(pw, RENDER_FORMAT_PREVIEW, 0);
- pw->layout_idle_id = -1;
+ pw->layout_idle_id = 0;
return FALSE;
}
print_window_layout_status(pw);
- if (pw->layout_idle_id == -1)
+ if (!pw->layout_idle_id)
{
pw->layout_idle_id = g_idle_add(print_window_layout_render_idle, pw);
}
vbox = pref_box_new(box, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
group = pref_frame_new(vbox, TRUE, _("Preview"), GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
- pw->layout_idle_id = -1;
+ pw->layout_idle_id = 0;
pw->layout_image = image_new(FALSE);
gtk_widget_set_size_request(pw->layout_image->widget, PRINT_DLG_PREVIEW_WIDTH, PRINT_DLG_PREVIEW_HEIGHT);
typedef struct _RemoteClient RemoteClient;
struct _RemoteClient {
gint fd;
- gint channel_id;
+ guint channel_id; /* event source id */
RemoteConnection *rc;
};
gint search_total;
gint search_buffer_count;
- gint search_idle_id;
- gint update_idle_id;
+ guint search_idle_id; /* event source id */
+ guint update_idle_id; /* event source id */
ImageLoader *img_loader;
CacheData *img_cd;
search_status_update(sd);
- sd->update_idle_id = -1;
+ sd->update_idle_id = 0;
return FALSE;
}
static void search_result_update_idle_cancel(SearchData *sd)
{
- if (sd->update_idle_id != -1) g_source_remove(sd->update_idle_id);
- sd->update_idle_id = -1;
+ if (sd->update_idle_id)
+ {
+ g_source_remove(sd->update_idle_id);
+ sd->update_idle_id = 0;
+ }
}
static gboolean search_result_select_cb(GtkTreeSelection *selection, GtkTreeModel *store,
{
SearchData *sd = data;
- if (sd->update_idle_id == -1)
+ if (!sd->update_idle_id)
{
sd->update_idle_id = g_idle_add(search_result_update_idle_cb, sd);
}
static void search_stop(SearchData *sd)
{
- if (sd->search_idle_id != -1)
+ if (sd->search_idle_id)
{
g_source_remove(sd->search_idle_id);
- sd->search_idle_id = -1;
+ sd->search_idle_id = 0;
}
image_loader_free(sd->img_loader);
{
if (search_file_next(sd))
{
- sd->search_idle_id = -1;
+ sd->search_idle_id = 0;
return FALSE;
}
return TRUE;
if (!sd->search_file_list && !sd->search_folder_list)
{
- sd->search_idle_id = -1;
+ sd->search_idle_id = 0;
search_stop(sd);
search_result_thumb_step(sd);
sd->search_similarity_path = g_strdup(example_file->path);
}
- sd->search_idle_id = -1;
- sd->update_idle_id = -1;
-
sd->window = window_new(GTK_WINDOW_TOPLEVEL, "search", NULL, NULL, _("Image search"));
gtk_window_set_resizable(GTK_WINDOW(sd->window), TRUE);
if (!slideshow_step(ss, TRUE))
{
- ss->timeout_id = -1;
+ ss->timeout_id = 0;
slideshow_free(ss);
return FALSE;
}
static void slideshow_timer_stop(SlideShowData *ss)
{
- if (ss->timeout_id == -1) return;
+ if (!ss->timeout_id) return;
g_source_remove(ss->timeout_id);
- ss->timeout_id = -1;
+ ss->timeout_id = 0;
}
static void slideshow_timer_reset(SlideShowData *ss)
{
if (options->slideshow.delay < 1) options->slideshow.delay = 1;
- if (ss->timeout_id != -1) g_source_remove(ss->timeout_id);
+ if (ss->timeout_id) g_source_remove(ss->timeout_id);
ss->timeout_id = g_timeout_add(options->slideshow.delay * 1000 / SLIDESHOW_SUBSECOND_PRECISION,
slideshow_loop_cb, ss);
}
ss->filelist = filelist;
ss->cd = cd;
ss->layout = lw;
- ss->timeout_id = -1;
if (ss->filelist)
{
{
ThumbLoader *tl = data;
- tl->idle_done_id = -1;
+ tl->idle_done_id = 0;
if (tl->func_done) tl->func_done(tl, tl->data);
static void thumb_loader_delay_done(ThumbLoader *tl)
{
- if (tl->idle_done_id == -1) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
+ if (!tl->idle_done_id) tl->idle_done_id = g_idle_add(thumb_loader_done_delay_cb, tl);
}
static void thumb_loader_setup(ThumbLoader *tl, const gchar *path)
tl->percent_done = 0.0;
tl->max_w = width;
tl->max_h = height;
- tl->idle_done_id = -1;
return tl;
}
image_loader_free(tl->il);
file_data_unref(tl->fd);
- if (tl->idle_done_id != -1) g_source_remove(tl->idle_done_id);
+ if (tl->idle_done_id) g_source_remove(tl->idle_done_id);
g_free(tl);
}
void (*func_valid)(const gchar *path, gboolean valid, gpointer data);
gpointer data;
- gint idle_id;
+ guint idle_id; /* event source id */
};
static void thumb_loader_std_thumb_file_validate_free(ThumbValidate *tv)
tv = tl->data;
- if (tv->idle_id != -1) g_source_remove(tv->idle_id);
- tv->idle_id = -1;
+ if (tv->idle_id)
+ {
+ g_source_remove(tv->idle_id);
+ tv->idle_id = 0;
+ }
thumb_loader_std_thumb_file_validate_free(tv);
}
{
ThumbValidate *tv = data;
- tv->idle_id = -1;
+ tv->idle_id = 0;
thumb_loader_std_thumb_file_validate_finish(tv, FALSE);
return FALSE;
}
else
{
- tv->idle_id = -1;
+ tv->idle_id = 0;
}
return tv->tl;
gpointer data;
- gint idle_done_id;
+ guint idle_done_id; /* event source id */
};
struct _CollectInfo
CollectInfo *click_info;
GtkWidget *tip_window;
- gint tip_delay_id;
+ guint tip_delay_id; /* event source id */
CollectInfo *tip_info;
GdkWindow *marker_window;
CollectInfo *drop_info;
GList *drop_list;
- gint sync_idle_id;
- gint drop_idle_id;
+ guint sync_idle_id; /* event source id */
+ guint drop_idle_id; /* event source id */
gboolean show_text;
FileData *drop_fd;
GList *drop_list;
- gint drop_scroll_id;
+ guint drop_scroll_id; /* event source id */
/* func list */
void (*select_func)(ViewDir *vd, const gchar *path, gpointer data);
struct _ViewDirInfoTree
{
- gint drop_expand_id;
+ guint drop_expand_id; /* event source id */
gint busy_ref;
};
gint clicked_mark;
/* refresh */
- gint refresh_idle_id;
+ guint refresh_idle_id; /* event source id */
/* file list for edit menu */
GList *editmenu_fd_list;
gboolean thumbs_enabled;
- gint select_idle_id;
+ guint select_idle_id; /* event source id */
};
struct _IconData;
struct _IconData *prev_selection;
GtkWidget *tip_window;
- gint tip_delay_id;
+ guint tip_delay_id; /* event source id */
struct _IconData *tip_id;
struct _IconData *click_id;
FileData *slide_fd;
guint slide_count;
- gint timeout_id;
+ guint timeout_id; /* event source id */
gboolean from_selection;
GtkWidget *normal_window;
ImageWindow *normal_imd;
- gint hide_mouse_id;
- gint busy_mouse_id;
+ guint hide_mouse_id; /* event source id */
+ guint busy_mouse_id; /* event source id */
+
gint cursor_state;
- gint saver_block_id;
+ guint saver_block_id; /* event source id */
void (*stop_func)(FullScreenData *, gpointer);
gpointer stop_data;
GtkWidget *image;
GList *list; /* list of pixbufs */
guint frame;
- gint timer_id;
+ guint timer_id; /* event source id */
};
static void spinner_set_frame(SpinnerData *sp, guint frame)
{
if (!sp) return;
- if (sp->timer_id != -1)
+ if (sp->timer_id)
{
g_source_remove(sp->timer_id);
- sp->timer_id = -1;
+ sp->timer_id = 0;
}
if (interval > 0)
SpinnerData *sp;
sp = g_new0(SpinnerData, 1);
- sp->list = NULL;
- sp->timer_id = -1;
if (path)
{
SpinnerData *sp;
sp = g_object_get_data(G_OBJECT(spinner), "spinner");
- if (sp->timer_id != -1)
+ if (sp->timer_id)
{
log_printf("spinner warning: attempt to step with timer set\n");
return;
typedef struct _AutoScrollData AutoScrollData;
struct _AutoScrollData
{
- gint timer_id;
+ guint timer_id; /* event source id */
gint region_size;
GtkWidget *widget;
GtkAdjustment *adj;
if (!sd) return;
g_object_set_data(G_OBJECT(widget), "autoscroll", NULL);
- if (sd->timer_id != -1) g_source_remove(sd->timer_id);
+ if (sd->timer_id) g_source_remove(sd->timer_id);
g_free(sd);
}
if (x < 0 || x >= w || y < 0 || y >= h)
{
- sd->timer_id = -1;
+ sd->timer_id = 0;
widget_auto_scroll_stop(sd->widget);
return FALSE;
}
/* only notify when scrolling is needed */
if (sd->notify_func && !sd->notify_func(sd->widget, x, y, sd->notify_data))
{
- sd->timer_id = -1;
+ sd->timer_id = 0;
widget_auto_scroll_stop(sd->widget);
return FALSE;
}
GenericDialog *gd;
FileDialog *fdlg;
- gint update_idle_id;
-
- gint perform_idle_id;
+ guint update_idle_id; /* event source id */
+ guint perform_idle_id; /* event source id */
gboolean with_sidecars; /* operate on grouped or single files; TRUE = use file_data_sc_, FALSE = use file_data_ functions */
ud->type = type;
ud->phase = UTILITY_PHASE_START;
- ud->update_idle_id = -1;
- ud->perform_idle_id = -1;
return ud;
}
{
if (!ud) return;
- if (ud->update_idle_id != -1) g_source_remove(ud->update_idle_id);
- if (ud->perform_idle_id != -1) g_source_remove(ud->perform_idle_id);
+ if (ud->update_idle_id) g_source_remove(ud->update_idle_id);
+ if (ud->perform_idle_id) g_source_remove(ud->perform_idle_id);
file_data_unref(ud->dir_fd);
filelist_free(ud->content_list);
{
UtilityData *ud = data;
- if (ud->perform_idle_id == -1)
+ if (!ud->perform_idle_id)
{
/* this function was called directly
just setup idle callback and wait until we are called again
file_util_rename_preview_update(ud);
- ud->update_idle_id = -1;
+ ud->update_idle_id = 0;
return FALSE;
}
{
UtilityData *ud = data;
- if (ud->update_idle_id != -1) return;
+ if (ud->update_idle_id) return;
ud->update_idle_id = g_idle_add(file_util_rename_idle_cb, ud);
}
ViewDir *vd = g_new0(ViewDir, 1);
- vd->drop_scroll_id = -1;
-
vd->widget = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vd->widget), GTK_SHADOW_IN);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vd->widget),
void vd_dnd_drop_scroll_cancel(ViewDir *vd)
{
- if (vd->drop_scroll_id != -1) g_source_remove(vd->drop_scroll_id);
- vd->drop_scroll_id = -1;
+ if (vd->drop_scroll_id)
+ {
+ g_source_remove(vd->drop_scroll_id);
+ vd->drop_scroll_id = 0;
+ }
}
static gboolean vd_auto_scroll_idle_cb(gpointer data)
}
}
- vd->drop_scroll_id = -1;
+ vd->drop_scroll_id = 0;
return FALSE;
}
if (!vd->drop_fd || vd->drop_list) return FALSE;
- if (vd->drop_scroll_id == -1) vd->drop_scroll_id = g_idle_add(vd_auto_scroll_idle_cb, vd);
+ if (!vd->drop_scroll_id) vd->drop_scroll_id = g_idle_add(vd_auto_scroll_idle_cb, vd);
return TRUE;
}
vdtree_expand_by_data(vd, vd->drop_fd, TRUE);
}
- VDTREE(vd)->drop_expand_id = -1;
+ VDTREE(vd)->drop_expand_id = 0;
return FALSE;
}
static void vdtree_dnd_drop_expand_cancel(ViewDir *vd)
{
- if (VDTREE(vd)->drop_expand_id != -1) g_source_remove(VDTREE(vd)->drop_expand_id);
- VDTREE(vd)->drop_expand_id = -1;
+ if (VDTREE(vd)->drop_expand_id)
+ {
+ g_source_remove(VDTREE(vd)->drop_expand_id);
+ VDTREE(vd)->drop_expand_id = 0;
+ }
}
static void vdtree_dnd_drop_expand(ViewDir *vd)
vd->info = g_new0(ViewDirInfoTree, 1);
vd->type = DIRVIEW_TREE;
- VDTREE(vd)->drop_expand_id = -1;
vd->dnd_drop_leave_func = vdtree_dnd_drop_expand_cancel;
vd->dnd_drop_update_func = vdtree_dnd_drop_expand;
vf->type = type;
vf->sort_method = SORT_NAME;
vf->sort_ascend = TRUE;
- vf->refresh_idle_id = -1;
vf->scrolled = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->scrolled), GTK_SHADOW_IN);
ViewFile *vf = data;
vf_refresh(vf);
- vf->refresh_idle_id = -1;
+ vf->refresh_idle_id = 0;
return FALSE;
}
void vf_refresh_idle_cancel(ViewFile *vf)
{
- if (vf->refresh_idle_id != -1) g_source_remove(vf->refresh_idle_id);
- vf->refresh_idle_id = -1;
+ if (vf->refresh_idle_id)
+ {
+ g_source_remove(vf->refresh_idle_id);
+ vf->refresh_idle_id = 0;
+ }
}
void vf_refresh_idle(ViewFile *vf)
{
- if (vf->refresh_idle_id == -1)
+ if (!vf->refresh_idle_id)
{
vf->refresh_idle_id = g_idle_add(vf_refresh_idle_cb, vf);
}
if (vf->marks_enabled) interested |= NOTIFY_MARKS | NOTIFY_METADATA;
/* FIXME: NOTIFY_METADATA should be checked by the keyword-to-mark functions and converted to NOTIFY_MARKS only if there was a change */
- if (!(type & interested) || vf->refresh_idle_id != -1 || !vf->dir_fd) return;
+ if (!(type & interested) || vf->refresh_idle_id || !vf->dir_fd) return;
refresh = (fd == vf->dir_fd);
ViewFile *vf = data;
GtkWidget *window;
- if (VFICON(vf)->tip_delay_id == -1) return FALSE;
+ if (!VFICON(vf)->tip_delay_id) return FALSE;
window = gtk_widget_get_toplevel(vf->listview);
tip_show(vf);
}
- VFICON(vf)->tip_delay_id = -1;
+ VFICON(vf)->tip_delay_id = 0;
return FALSE;
}
{
tip_hide(vf);
- if (VFICON(vf)->tip_delay_id != -1)
+ if (VFICON(vf)->tip_delay_id)
{
g_source_remove(VFICON(vf)->tip_delay_id);
- VFICON(vf)->tip_delay_id = -1;
+ VFICON(vf)->tip_delay_id = 0;
}
if (!VFICON(vf)->show_text)
{
tip_hide(vf);
- if (VFICON(vf)->tip_delay_id != -1) g_source_remove(VFICON(vf)->tip_delay_id);
- VFICON(vf)->tip_delay_id = -1;
+ if (VFICON(vf)->tip_delay_id)
+ {
+ g_source_remove(VFICON(vf)->tip_delay_id);
+ VFICON(vf)->tip_delay_id = 0;
+ }
}
static void tip_update(ViewFile *vf, IconData *id)
vf->info = g_new0(ViewFileInfoIcon, 1);
- VFICON(vf)->tip_delay_id = -1;
VFICON(vf)->show_text = options->show_icon_names;
store = gtk_list_store_new(1, G_TYPE_POINTER);
if (!vf->layout)
{
- VFLIST(vf)->select_idle_id = -1;
+ VFLIST(vf)->select_idle_id = 0;
return FALSE;
}
VFLIST(vf)->select_fd = NULL;
}
- VFLIST(vf)->select_idle_id = -1;
+ VFLIST(vf)->select_idle_id = 0;
return FALSE;
}
static void vflist_select_idle_cancel(ViewFile *vf)
{
- if (VFLIST(vf)->select_idle_id != -1) g_source_remove(VFLIST(vf)->select_idle_id);
- VFLIST(vf)->select_idle_id = -1;
+ if (VFLIST(vf)->select_idle_id)
+ {
+ g_source_remove(VFLIST(vf)->select_idle_id);
+ VFLIST(vf)->select_idle_id = 0;
+ }
}
static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
}
if (vf->layout &&
- VFLIST(vf)->select_idle_id == -1)
+ !VFLIST(vf)->select_idle_id)
{
VFLIST(vf)->select_idle_id = g_idle_add(vflist_select_idle_cb, vf);
}
vf->info = g_new0(ViewFileInfoList, 1);
- VFLIST(vf)->select_idle_id = -1;
-
flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
flist_types[FILE_COLUMN_VERSION] = G_TYPE_INT;
flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;