# HG changeset patch # User zas_ # Date 1216136234 0 # Node ID e418c33a49c8174ed8b955697eb15bb18f765837 # Parent 04c317fb7da0629d3241b05ffa1a8495ca5b4aef Move code from image_osd_update_cb() to separate functions. diff -r 04c317fb7da0 -r e418c33a49c8 src/image-overlay.c --- a/src/image-overlay.c Tue Jul 15 14:32:00 2008 +0000 +++ b/src/image-overlay.c Tue Jul 15 15:37:14 2008 +0000 @@ -815,6 +815,26 @@ } } +static void image_osd_info_show(OverlayStateData *osd, GdkPixbuf *pixbuf) +{ + if (osd->ovl_info == 0) + { + osd->ovl_info = image_overlay_add(osd->imd, pixbuf, osd->x, osd->y, OVL_RELATIVE); + } + else + { + image_overlay_set(osd->imd, osd->ovl_info, pixbuf, osd->x, osd->y); + } +} + +static void image_osd_info_hide(OverlayStateData *osd) +{ + if (osd->ovl_info == 0) return; + + image_overlay_remove(osd->imd, osd->ovl_info); + osd->ovl_info = 0; +} + static gint image_osd_update_cb(gpointer data) { OverlayStateData *osd = data; @@ -830,31 +850,18 @@ pixbuf = image_osd_info_render(osd); if (pixbuf) { - if (osd->ovl_info == 0) - { - osd->ovl_info = image_overlay_add(osd->imd, pixbuf, - osd->x, osd->y, OVL_RELATIVE); - } - else - { - image_overlay_set(osd->imd, osd->ovl_info, pixbuf, osd->x, osd->y); - } + image_osd_info_show(osd, pixbuf); g_object_unref(pixbuf); } - else if (osd->ovl_info) + else { - image_overlay_remove(osd->imd, osd->ovl_info); - osd->ovl_info = 0; + image_osd_info_hide(osd); } } } else { - if (osd->ovl_info) - { - image_overlay_remove(osd->imd, osd->ovl_info); - osd->ovl_info = 0; - } + image_osd_info_hide(osd); } if (osd->show & OSD_SHOW_STATUS) @@ -978,8 +985,8 @@ g_signal_handler_disconnect(osd->imd->pr, osd->destroy_id); image_set_state_func(osd->imd, NULL, NULL); - image_overlay_remove(osd->imd, osd->ovl_info); + image_osd_info_hide(osd); image_osd_icons_hide(osd); }