Mercurial > geeqie.yaz
comparison src/print.c @ 1523:24a12aa0cb54
Fix up event source ids type: gint -> guint.
Functions like g_timeout_add() or g_idle_add() return a guint
greater than 0, but in most places it was wrongly stored as int
and initialized to -1.
This broke assertions matching in g_source_remove() for example
since id was always greater than 0 even when timer was not set
(-1 was casted to the biggest guint).
author | zas_ |
---|---|
date | Mon, 06 Apr 2009 22:13:54 +0000 |
parents | f879e7d94c6d |
children | 3f47ab223486 |
comparison
equal
deleted
inserted
replaced
1522:d7206703d90f | 1523:24a12aa0cb54 |
---|---|
230 | 230 |
231 ImageWindow *layout_image; | 231 ImageWindow *layout_image; |
232 gdouble layout_width; | 232 gdouble layout_width; |
233 gdouble layout_height; | 233 gdouble layout_height; |
234 | 234 |
235 gint layout_idle_id; | 235 guint layout_idle_id; /* event source id */ |
236 | 236 |
237 gdouble image_scale; | 237 gdouble image_scale; |
238 | 238 |
239 GtkWidget *image_scale_spin; | 239 GtkWidget *image_scale_spin; |
240 | 240 |
568 gtk_widget_set_sensitive(pw->print_button, total > 0); | 568 gtk_widget_set_sensitive(pw->print_button, total > 0); |
569 } | 569 } |
570 | 570 |
571 static void print_window_layout_render_stop(PrintWindow *pw) | 571 static void print_window_layout_render_stop(PrintWindow *pw) |
572 { | 572 { |
573 if (pw->layout_idle_id != -1) | 573 if (pw->layout_idle_id) |
574 { | 574 { |
575 g_source_remove(pw->layout_idle_id); | 575 g_source_remove(pw->layout_idle_id); |
576 pw->layout_idle_id = -1; | 576 pw->layout_idle_id = 0; |
577 } | 577 } |
578 } | 578 } |
579 | 579 |
580 static gboolean print_window_layout_render_idle(gpointer data) | 580 static gboolean print_window_layout_render_idle(gpointer data) |
581 { | 581 { |
582 PrintWindow *pw = data; | 582 PrintWindow *pw = data; |
583 | 583 |
584 print_job_close(pw, FALSE); | 584 print_job_close(pw, FALSE); |
585 print_job_start(pw, RENDER_FORMAT_PREVIEW, 0); | 585 print_job_start(pw, RENDER_FORMAT_PREVIEW, 0); |
586 | 586 |
587 pw->layout_idle_id = -1; | 587 pw->layout_idle_id = 0; |
588 return FALSE; | 588 return FALSE; |
589 } | 589 } |
590 | 590 |
591 static void print_window_layout_render(PrintWindow *pw) | 591 static void print_window_layout_render(PrintWindow *pw) |
592 { | 592 { |
596 pw->proof_columns = (pw->layout_width - pw->margin_left - pw->margin_right) / proof_w; | 596 pw->proof_columns = (pw->layout_width - pw->margin_left - pw->margin_right) / proof_w; |
597 pw->proof_rows = (pw->layout_height - pw->margin_top - pw->margin_bottom) / proof_h; | 597 pw->proof_rows = (pw->layout_height - pw->margin_top - pw->margin_bottom) / proof_h; |
598 | 598 |
599 print_window_layout_status(pw); | 599 print_window_layout_status(pw); |
600 | 600 |
601 if (pw->layout_idle_id == -1) | 601 if (!pw->layout_idle_id) |
602 { | 602 { |
603 pw->layout_idle_id = g_idle_add(print_window_layout_render_idle, pw); | 603 pw->layout_idle_id = g_idle_add(print_window_layout_render_idle, pw); |
604 } | 604 } |
605 } | 605 } |
606 | 606 |
748 GtkWidget *button; | 748 GtkWidget *button; |
749 | 749 |
750 vbox = pref_box_new(box, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); | 750 vbox = pref_box_new(box, TRUE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); |
751 group = pref_frame_new(vbox, TRUE, _("Preview"), GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); | 751 group = pref_frame_new(vbox, TRUE, _("Preview"), GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP); |
752 | 752 |
753 pw->layout_idle_id = -1; | 753 pw->layout_idle_id = 0; |
754 | 754 |
755 pw->layout_image = image_new(FALSE); | 755 pw->layout_image = image_new(FALSE); |
756 gtk_widget_set_size_request(pw->layout_image->widget, PRINT_DLG_PREVIEW_WIDTH, PRINT_DLG_PREVIEW_HEIGHT); | 756 gtk_widget_set_size_request(pw->layout_image->widget, PRINT_DLG_PREVIEW_WIDTH, PRINT_DLG_PREVIEW_HEIGHT); |
757 | 757 |
758 gtk_box_pack_start(GTK_BOX(group), pw->layout_image->widget, TRUE, TRUE, 0); | 758 gtk_box_pack_start(GTK_BOX(group), pw->layout_image->widget, TRUE, TRUE, 0); |