void DeadPipe (int nonsense) { static int already_dead = False ; if( already_dead ) return; already_dead = True ; g_signal_handlers_disconnect_by_func (AppState.volumeMonitor, G_CALLBACK (mount_added), NULL); g_signal_handlers_disconnect_by_func (AppState.volumeMonitor, G_CALLBACK (mount_changed), NULL); g_signal_handlers_disconnect_by_func (AppState.volumeMonitor, G_CALLBACK (mount_removed), NULL); g_signal_handlers_disconnect_by_func (AppState.volumeMonitor, G_CALLBACK (volume_added), NULL); g_signal_handlers_disconnect_by_func (AppState.volumeMonitor, G_CALLBACK (volume_changed), NULL); g_signal_handlers_disconnect_by_func (AppState.volumeMonitor, G_CALLBACK (volume_removed), NULL); destroy_asbidirlist ( &(AppState.volumes)); free_button_resources (AppState.buttons[0]); free_button_resources (AppState.buttons[1]); /* window_data_cleanup(); destroy_ascanvas( &PagerState.main_canvas ); destroy_ascanvas( &PagerState.icon_canvas ); if( Config ) DestroyPagerConfig (Config); */ FreeMyAppResources(); #ifdef DEBUG_ALLOCS print_unfreed_mem (); #endif /* DEBUG_ALLOCS */ XFlush (dpy); XCloseDisplay (dpy); exit (0); }
/* some ASTBarProps utilities to be used by modules : *************************************************************************/ Bool button_from_astbar_props( struct ASTBarProps *tbar_props, struct button_t *button, int context, Atom kind, Atom kind_pressed ) { int found = 0; if( button == NULL ) return False; free_button_resources( button ) ; memset( button, 0x00, sizeof(MyButton)); if( tbar_props != NULL ) { int i ; for( i = 0 ; i < tbar_props->buttons_num ; ++i ) { MyIcon *icon = NULL ; if( tbar_props->buttons[i].kind == kind ) icon = &(button->unpressed); else if( tbar_props->buttons[i].kind == kind_pressed ) icon = &(button->pressed); if( icon != NULL ) { icon_from_pixmaps( icon, tbar_props->buttons[i].pmap, tbar_props->buttons[i].mask, tbar_props->buttons[i].alpha ); /* these does not belong to us !!!*/ icon->pix = None ; icon->mask = None ; icon->alpha = None ; if (icon->image) found++; } } button->width = max( button->unpressed.width, button->width ); button->height = max( button->unpressed.height, button->height ); if( button->height > 0 && button->width > 0 ) button->context = context ; } return (found > 0 && button->height > 0 && button->width > 0 ); }
void reloadButtons () { int i; static char *button_imgs[BUTTONS_NUM][2] = {{"mount-white", "mount-green-pressed"}, {"unmount-white", "unmount-red-pressed"}, {"eject-white", "eject-red-pressed"}}; static int button_contexts[BUTTONS_NUM] = { MOUNT_CONTEXT, UNMOUNT_CONTEXT, EJECT_CONTEXT}; int btn_size = (AppState.tileWidth - 15) / 2; for ( i = 0 ; i < BUTTONS_NUM ; ++i){ if (AppState.buttons[i] == NULL) AppState.buttons[i] = safecalloc (1, sizeof(struct button_t)); else free_button_resources (AppState.buttons[i]); load_button (AppState.buttons[i], button_imgs[i], Scr.image_manager ); AppState.buttons[i]->context = button_contexts[i]; LOCAL_DEBUG_OUT ("button[%d].size = %dx%d, image %dx%d", i, AppState.buttons[i]->width, AppState.buttons[i]->height, AppState.buttons[i]->pressed.image?AppState.buttons[i]->pressed.image->width:0, AppState.buttons[i]->pressed.image?AppState.buttons[i]->pressed.image->height:0); scale_button (AppState.buttons[i], btn_size, btn_size, Scr.asv); } }